home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #9 / Amiga Plus CD - 2004 - No. 09.iso / amigaplus / tools / amigaos4_only / binutils / binutils-2.14.patch
Encoding:
Text File  |  2004-08-03  |  3.5 MB  |  113,359 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1. diff -urNEBb binutils-2.14-orig/bfd/ChangeLog-9697 binutils-2.14/bfd/ChangeLog-9697
  2. --- binutils-2.14-orig/bfd/ChangeLog-9697    2001-03-08 22:03:56.000000000 +0100
  3. +++ binutils-2.14/bfd/ChangeLog-9697    2003-12-02 14:09:39.000000000 +0100
  4. @@ -49,6 +49,13 @@
  5.          * config.bfd (i[3456]86*-go32-rtems*): Fix to be the same as
  6.      i[3456]86-go32.
  7.  
  8. +Fri Dec 19 14:25:58 1997  Daniel Verite  <daniel@brainstorm.fr>
  9. +
  10. +    * amigaos.c (amiga_bfd_copy_private_section_data): Add return
  11. +     value. 
  12. +     * amigaoslink.c (amiga_final_link): Update linker_mark fields for
  13. +     input sections involved in the output.
  14. +
  15.  Thu Dec 18 16:01:25 1997  Doug Evans  <devans@canuck.cygnus.com>
  16.  
  17.      * configure: Regenerate to get @SHELL@ substituted.
  18. @@ -597,6 +604,16 @@
  19.      (assign_file_positions_for_segments): Increment the file offset
  20.      for a section with contents, even if it is not loadable.
  21.  
  22. +Tue Sep 23 09:46:10 1997  Fred Fish  <fnf@ninemoons.com>
  23. +
  24. +    * amigaos.c (alloca): Only declare if not defined as macro.
  25. +
  26. +Mon Sep 22 10:15:30 1997  Fred Fish  <fnf@ninemoons.com>
  27. +
  28. +    * amigaos.c (sysdep.h): Relocate include to provided needed
  29. +    <sys/types.h> file.
  30. +    * amigaoslink.c (sysdep.h): Ditto, and remove <sys/types.h>.
  31. +
  32.  Sun Sep 21 11:03:24 1997  Nick Clifton  <nickc@cygnus.com>
  33.  
  34.      * elf32-v850.c (v850_elf_final_link_relocate): Add return code
  35. @@ -767,6 +784,12 @@
  36.      * Makefile.in: Rebuild.
  37.      * doc/Makefile.in: Rebuild.
  38.  
  39. +Mon Aug 25 16:32:00 1997  Steffen Opel  <opel@rumms.uni-mannheim.de>
  40. +
  41. +    * Makefile.in (guide, install-guide, clean-guide, bfd.guide): 
  42. +    New targets for AmigaGuide documentation.
  43. +     (install): Add install-info and install-guide.
  44. +
  45.  Mon Aug 25 16:14:34 1997  Christopher Provenzano  <proven@cygnus.com>
  46.  
  47.      * configure: Rebuild with latest devo autoconf for NT support
  48. @@ -3767,6 +3790,12 @@
  49.      (ihex_write_object_contents): Remove extbase; always use segbase
  50.      instead.
  51.  
  52. +Thu Aug 29 17:53:51 1996  Daniel Verite <daniel@brainstorm.eu.org>
  53. +
  54. +    * amigaos.c (amiga_get_section_contents): Handle sections that
  55. +    are larger than their disksize.
  56. +    (amiga_make_unique_section): Remove infinite loop.
  57. +
  58.  Thu Aug 29 16:52:17 1996  Michael Meissner  <meissner@tiktok.cygnus.com>
  59.  
  60.      * configure.in (i[345]86-*-*): Recognize i686 for pentium pro.
  61. @@ -3992,6 +4021,13 @@
  62.      check dynsec when deciding whether to start a new segment for a
  63.      writeable section; -N will now handle this.
  64.  
  65. +Sun Aug  4 22:15:56 1996  Fred Fish  <fnf@ninemoons.com>
  66. +
  67. +    * amigaoslink.c (sys/types.h): Include before genlink.h to get
  68. +    definition for size_t which is used in genlink.h.  This was not
  69. +    getting defined during a cross compilation on alpha-dec-osf2.0 for
  70. +    some reason.
  71. +
  72.  Thu Aug  1 22:43:08 1996  Jeffrey A Law  (law@cygnus.com)
  73.  
  74.      * libhppa.h: Remove "esel" changes.  Not the right approach.
  75. @@ -4088,6 +4124,11 @@
  76.      * configure.in: Fix test for whether a compiler has a 64 bit
  77.      type.  From Jim Wilson <wilson@cygnus.com>.
  78.  
  79. +Thu Jul 18 16:58:11 1996  Daniel Verite <daniel@brainstorm.eu.org>
  80. +
  81. +    * amigaoslink.c (aout_perform_reloc): Fix baserel 16 bits relocs.
  82. +    (my_add_to): Fix sign bug in extraction of 16 bits values.
  83. +
  84.  Thu Jul 18 15:39:10 1996  Ian Lance Taylor  <ian@cygnus.com>
  85.  
  86.      * configure.host (mips-sgi-irix6*): New host.
  87. @@ -4217,6 +4258,11 @@
  88.      (mips_relocate_section): Permit an arbitrary number of REFHI or
  89.      RELHI relocs before the associated REFLO or RELLO reloc.
  90.  
  91. +Sun Jul  7 12:15:39 1996  Kamil Iskra <iskra@student.uci.agh.edu.pl>
  92. +
  93. +    * amigaos.c (amiga_write_symbols): Fix Daniel's workaround for
  94. +    outputting long symbol names.
  95. +
  96.  Fri Jul  5 19:27:49 1996  Ian Lance Taylor  <ian@cygnus.com>
  97.  
  98.      * aout-target.h (MY(callback)): Set reloc_count fields.
  99. @@ -4296,6 +4342,11 @@
  100.      (elf64_alpha_adjust_dynamic_symbol): If a symbol has its address
  101.      taken, we cannot generate a .plt entry for the symbol.
  102.  
  103. +Thu Jun 27 17:35:32 1996 Daniel Verite <daniel@brainstorm.eu.org>
  104. +
  105. +    * amigaos.c (amiga_write_object_contents): Don't output symbols
  106. +    which are not attached to any section, such as indirect symbols.
  107. +
  108.  Thu Jun 27 11:24:29 1996  Ian Lance Taylor  <ian@cygnus.com>
  109.  
  110.      * configure.in: Add AC_ISC_POSIX, and check for setitimer and
  111. @@ -4525,6 +4576,19 @@
  112.      common symbol defined by the linker.  Don't export function code
  113.      even if export_defineds is set.
  114.  
  115. +Tue Jun 11 12:52:10 1996 Daniel Verite <daniel@brainstorm.eu.org>
  116. +
  117. +    * amigaoslink.c (mygeta4): Function removed.
  118. +    (amiga_final_link): Search for ___a4_init symbol in the global hash
  119. +    table and cache its value in the backend data.
  120. +
  121. +    * amigaos.c (write_longs): Return a boolean instead of the
  122. +    number of longs written.
  123. +    (write_section_contents): Split reloc hunks at 0xffff entries.
  124. +    (amiga_write_symbols): Cut the names in hunk symbols at 124 characters
  125. +    (workaround for an amigaos bug).
  126. +    (amiga_handle_rest): Added a sanity check in reloc hunks parsing.
  127. +
  128.  Mon Jun 10 11:57:27 1996  Jeffrey A Law  (law@cygnus.com)
  129.  
  130.      * coff-h8300.c (howto_table): Add new entries for R_BCC_INV
  131. diff -urNEBb binutils-2.14-orig/bfd/ChangeLog-9899 binutils-2.14/bfd/ChangeLog-9899
  132. --- binutils-2.14-orig/bfd/ChangeLog-9899    2001-03-08 22:03:56.000000000 +0100
  133. +++ binutils-2.14/bfd/ChangeLog-9899    2003-12-02 14:09:39.000000000 +0100
  134. @@ -5573,6 +5573,11 @@
  135.  
  136.      * cpu-sh.c (arch_info_struct): Correct next field of sh3e.
  137.  
  138. +Sun Jan 18 10:39:52 1998  Daniel Verite <daniel@brainstorm.fr>
  139. +
  140. +    * amigaos.c (CAN_WRITE_OUTSYM): New macro.
  141. +    (amiga_write_object_contents): Use CAN_WRITE_OUTSYM
  142. +
  143.  Wed Jan 14 17:23:27 1998  Nick Clifton  <nickc@cygnus.com>
  144.  
  145.      * elf32-m32r.c: Add macros to handle NOP insertion.
  146. diff -urNEBb binutils-2.14-orig/bfd/Makefile.am binutils-2.14/bfd/Makefile.am
  147. --- binutils-2.14-orig/bfd/Makefile.am    2003-04-21 14:24:18.000000000 +0200
  148. +++ binutils-2.14/bfd/Makefile.am    2003-12-02 14:09:39.000000000 +0100
  149. @@ -162,7 +162,10 @@
  150.  # The .o files needed by all of the 32 bit vectors that are configured into
  151.  # target_vector in targets.c if configured with --enable-targets=all.
  152.  BFD32_BACKENDS = \
  153. +    amigaos.lo \
  154. +    amigaoslink.lo \
  155.      aout-adobe.lo \
  156. +    aout-amiga.lo \
  157.      aout-arm.lo \
  158.      aout-cris.lo \
  159.      aout-ns32k.lo \
  160. @@ -211,6 +214,7 @@
  161.      elf32-arc.lo \
  162.      elfarm-oabi.lo \
  163.      elfarm-nabi.lo \
  164. +    elf32-amiga.lo \
  165.      elf32-avr.lo \
  166.      elf32-cris.lo \
  167.      elf32-d10v.lo \
  168. @@ -237,6 +241,7 @@
  169.      elf-m10200.lo \
  170.      elf-m10300.lo \
  171.      elf32-mcore.lo \
  172. +    elf32-morphos.lo \
  173.      elfxx-mips.lo \
  174.      elf32-mips.lo \
  175.      elf32-msp430.lo \
  176. @@ -326,7 +331,10 @@
  177.      xtensa-modules.lo
  178.  
  179.  BFD32_BACKENDS_CFILES = \
  180. +    amigaos.c \
  181. +    amigaoslink.c \
  182.      aout-adobe.c \
  183. +    aout-amiga.c \
  184.      aout-arm.c \
  185.      aout-cris.c \
  186.      aout-ns32k.c \
  187. @@ -375,6 +383,7 @@
  188.      elf32-arc.c \
  189.      elfarm-oabi.c \
  190.      elfarm-nabi.c \
  191. +    elf32-amiga.c \
  192.      elf32-avr.c \
  193.      elf32-cris.c \
  194.      elf32-d10v.c \
  195. @@ -400,6 +409,7 @@
  196.      elf-m10200.c \
  197.      elf-m10300.c \
  198.      elf32-mcore.c \
  199. +    elf32-morphos.lo \
  200.      elfxx-mips.c \
  201.      elf32-mips.c \
  202.      elf32-msp430.c \
  203. @@ -587,7 +597,7 @@
  204.      aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
  205.      elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \
  206.      elf64-hppa.h elfcode.h elfcore.h elflink.h \
  207. -    freebsd.h genlink.h go32stub.h \
  208. +    freebsd.h genlink.h go32stub.h libamiga.h \
  209.      libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
  210.      libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
  211.      netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
  212. @@ -969,6 +979,9 @@
  213.  cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
  214.  cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
  215.  cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
  216. +amigaos.lo: amigaos.c libamiga.h bfd.h
  217. +amigaoslink.lo: bfd.h libamiga.h amigaoslink.c
  218. +aout-amiga.lo: aout-amiga.c aoutf1.h bfd.h
  219.  aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
  220.    $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
  221.    $(INCDIR)/bfdlink.h
  222. @@ -1122,6 +1135,10 @@
  223.  elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  224.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  225.    $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
  226. +elf32-amiga.lo: elf32-amiga.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  227. +  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  228. +  $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
  229. +  elf32-target.h
  230.  elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
  231.    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  232.    $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
  233. @@ -1181,6 +1198,10 @@
  234.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  235.    $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
  236.    elf32-target.h
  237. +elf32-i386-amithlon.lo: elf32-i386-amithlon.c elf32-i386.c $(INCDIR)/filenames.h \
  238. +  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
  239. +  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
  240. +  $(INCDIR)/elf/reloc-macros.h elf32-target.h
  241.  elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
  242.    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  243.    $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
  244. @@ -1262,6 +1283,10 @@
  245.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  246.    $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h \
  247.    elf32-target.h
  248. +elf32-morphos.lo: elf32-morphos.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  249. +  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  250. +  $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
  251. +  elf32-target.h
  252.  elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  253.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  254.    $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
  255. diff -urNEBb binutils-2.14-orig/bfd/Makefile.in binutils-2.14/bfd/Makefile.in
  256. --- binutils-2.14-orig/bfd/Makefile.in    2003-05-02 18:06:14.000000000 +0200
  257. +++ binutils-2.14/bfd/Makefile.in    2003-12-02 14:09:39.000000000 +0100
  258. @@ -1,6 +1,8 @@
  259. -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
  260. +# Makefile.in generated by automake 1.7.4 from Makefile.am.
  261. +# @configure_input@
  262.  
  263. -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
  264. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
  265. +# Free Software Foundation, Inc.
  266.  # This Makefile.in is free software; the Free Software Foundation
  267.  # gives unlimited permission to copy and/or distribute it,
  268.  # with or without modifications, as long as this notice is preserved.
  269. @@ -10,30 +12,11 @@
  270.  # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  271.  # PARTICULAR PURPOSE.
  272.  
  273. -
  274. -SHELL = @SHELL@
  275. +@SET_MAKE@
  276.  
  277.  srcdir = @srcdir@
  278.  top_srcdir = @top_srcdir@
  279.  VPATH = @srcdir@
  280. -prefix = @prefix@
  281. -exec_prefix = @exec_prefix@
  282. -
  283. -bindir = @bindir@
  284. -sbindir = @sbindir@
  285. -libexecdir = @libexecdir@
  286. -datadir = @datadir@
  287. -sysconfdir = @sysconfdir@
  288. -sharedstatedir = @sharedstatedir@
  289. -localstatedir = @localstatedir@
  290. -libdir = @libdir@
  291. -infodir = @infodir@
  292. -mandir = @mandir@
  293. -includedir = @includedir@
  294. -oldincludedir = /usr/include
  295. -
  296. -DESTDIR =
  297. -
  298.  pkgdatadir = $(datadir)/@PACKAGE@
  299.  pkglibdir = $(libdir)/@PACKAGE@
  300.  pkgincludedir = $(includedir)/@PACKAGE@
  301. @@ -37,34 +20,34 @@
  302.  pkgdatadir = $(datadir)/@PACKAGE@
  303.  pkglibdir = $(libdir)/@PACKAGE@
  304.  pkgincludedir = $(includedir)/@PACKAGE@
  305. -
  306.  top_builddir = .
  307.  
  308. -ACLOCAL = @ACLOCAL@
  309. -AUTOCONF = @AUTOCONF@
  310. -AUTOMAKE = @AUTOMAKE@
  311. -AUTOHEADER = @AUTOHEADER@
  312. -
  313. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
  314.  INSTALL = @INSTALL@
  315. -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
  316. -INSTALL_DATA = @INSTALL_DATA@
  317. -INSTALL_SCRIPT = @INSTALL_SCRIPT@
  318. -transform = @program_transform_name@
  319. -
  320. +install_sh_DATA = $(install_sh) -c -m 644
  321. +install_sh_PROGRAM = $(install_sh) -c
  322. +install_sh_SCRIPT = $(install_sh) -c
  323. +INSTALL_HEADER = $(INSTALL_DATA)
  324. +transform = $(program_transform_name)
  325.  NORMAL_INSTALL = :
  326.  PRE_INSTALL = :
  327.  POST_INSTALL = :
  328.  NORMAL_UNINSTALL = :
  329.  PRE_UNINSTALL = :
  330.  POST_UNINSTALL = :
  331. -build_alias = @build_alias@
  332.  build_triplet = @build@
  333. -host_alias = @host_alias@
  334.  host_triplet = @host@
  335. -target_alias = @target_alias@
  336.  target_triplet = @target@
  337. +ACLOCAL = @ACLOCAL@
  338. +ALLOCA = @ALLOCA@
  339. +AMDEP_FALSE = @AMDEP_FALSE@
  340. +AMDEP_TRUE = @AMDEP_TRUE@
  341. +AMTAR = @AMTAR@
  342.  AR = @AR@
  343. -AS = @AS@
  344. +AUTOCONF = @AUTOCONF@
  345. +AUTOHEADER = @AUTOHEADER@
  346. +AUTOMAKE = @AUTOMAKE@
  347. +AWK = @AWK@
  348.  BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
  349.  BFD_HOST_64_BIT = @BFD_HOST_64_BIT@
  350.  BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@
  351. @@ -72,54 +55,120 @@
  352.  CATALOGS = @CATALOGS@
  353.  CATOBJEXT = @CATOBJEXT@
  354.  CC = @CC@
  355. +CCDEPMODE = @CCDEPMODE@
  356.  CC_FOR_BUILD = @CC_FOR_BUILD@
  357. +CFLAGS = @CFLAGS@
  358.  COREFILE = @COREFILE@
  359.  COREFLAG = @COREFLAG@
  360. -CXX = @CXX@
  361. -CXXCPP = @CXXCPP@
  362. +CPP = @CPP@
  363. +CPPFLAGS = @CPPFLAGS@
  364.  DATADIRNAME = @DATADIRNAME@
  365. -DLLTOOL = @DLLTOOL@
  366. +DEFS = @DEFS@
  367. +DEPDIR = @DEPDIR@
  368. +ECHO_C = @ECHO_C@
  369. +ECHO_N = @ECHO_N@
  370. +ECHO_T = @ECHO_T@
  371. +EGREP = @EGREP@
  372.  EXEEXT = @EXEEXT@
  373.  EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
  374. -GCJ = @GCJ@
  375. -GCJFLAGS = @GCJFLAGS@
  376.  GMOFILES = @GMOFILES@
  377.  GMSGFMT = @GMSGFMT@
  378.  GT_NO = @GT_NO@
  379.  GT_YES = @GT_YES@
  380.  HDEFINES = @HDEFINES@
  381.  INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
  382. +INSTALL_DATA = @INSTALL_DATA@
  383. +INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@
  384. +INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@
  385. +INSTALL_PROGRAM = @INSTALL_PROGRAM@
  386. +INSTALL_SCRIPT = @INSTALL_SCRIPT@
  387. +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
  388.  INSTOBJEXT = @INSTOBJEXT@
  389.  INTLDEPS = @INTLDEPS@
  390.  INTLLIBS = @INTLLIBS@
  391.  INTLOBJS = @INTLOBJS@
  392. +LDFLAGS = @LDFLAGS@
  393. +LIBOBJS = @LIBOBJS@
  394. +LIBS = @LIBS@
  395.  LIBTOOL = @LIBTOOL@
  396.  LN_S = @LN_S@
  397. +LTLIBOBJS = @LTLIBOBJS@
  398.  MAINT = @MAINT@
  399. +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
  400. +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
  401.  MAKEINFO = @MAKEINFO@
  402.  MKINSTALLDIRS = @MKINSTALLDIRS@
  403.  MSGFMT = @MSGFMT@
  404. -OBJDUMP = @OBJDUMP@
  405.  OBJEXT = @OBJEXT@
  406.  PACKAGE = @PACKAGE@
  407. +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
  408. +PACKAGE_NAME = @PACKAGE_NAME@
  409. +PACKAGE_STRING = @PACKAGE_STRING@
  410. +PACKAGE_TARNAME = @PACKAGE_TARNAME@
  411. +PACKAGE_VERSION = @PACKAGE_VERSION@
  412. +PATH_SEPARATOR = @PATH_SEPARATOR@
  413.  POFILES = @POFILES@
  414.  POSUB = @POSUB@
  415.  RANLIB = @RANLIB@
  416. +SET_MAKE = @SET_MAKE@
  417. +SHELL = @SHELL@
  418.  STRIP = @STRIP@
  419.  TDEFINES = @TDEFINES@
  420.  USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
  421.  USE_NLS = @USE_NLS@
  422.  VERSION = @VERSION@
  423. +
  424. +WARN_CFLAGS = @WARN_CFLAGS@
  425.  WIN32LDFLAGS = @WIN32LDFLAGS@
  426.  WIN32LIBADD = @WIN32LIBADD@
  427. +XGETTEXT = @XGETTEXT@
  428. +ac_ct_AR = @ac_ct_AR@
  429. +ac_ct_CC = @ac_ct_CC@
  430. +ac_ct_RANLIB = @ac_ct_RANLIB@
  431. +ac_ct_STRIP = @ac_ct_STRIP@
  432.  all_backends = @all_backends@
  433. +am__include = @am__include@
  434. +am__quote = @am__quote@
  435.  bfd_backends = @bfd_backends@
  436.  bfd_default_target_size = @bfd_default_target_size@
  437.  bfd_libs = @bfd_libs@
  438.  bfd_machines = @bfd_machines@
  439.  bfd_version = @bfd_version@
  440.  bfd_version_string = @bfd_version_string@
  441. +bfdincludedir = @bfdincludedir@
  442. +bfdlibdir = @bfdlibdir@
  443. +bindir = @bindir@
  444. +build = @build@
  445. +build_alias = @build_alias@
  446. +build_cpu = @build_cpu@
  447. +build_os = @build_os@
  448. +build_vendor = @build_vendor@
  449. +datadir = @datadir@
  450. +exec_prefix = @exec_prefix@
  451. +host = @host@
  452. +host_alias = @host_alias@
  453. +host_cpu = @host_cpu@
  454. +host_os = @host_os@
  455. +host_vendor = @host_vendor@
  456. +includedir = @includedir@
  457. +infodir = @infodir@
  458. +install_sh = @install_sh@
  459.  l = @l@
  460. +libdir = @libdir@
  461. +libexecdir = @libexecdir@
  462. +localstatedir = @localstatedir@
  463. +mandir = @mandir@
  464. +oldincludedir = @oldincludedir@
  465. +prefix = @prefix@
  466. +program_transform_name = @program_transform_name@
  467. +sbindir = @sbindir@
  468. +sharedstatedir = @sharedstatedir@
  469. +sysconfdir = @sysconfdir@
  470. +target = @target@
  471. +target_alias = @target_alias@
  472. +target_cpu = @target_cpu@
  473. +target_os = @target_os@
  474. +target_vendor = @target_vendor@
  475.  tdefaults = @tdefaults@
  476.  wordsize = @wordsize@
  477.  
  478. @@ -132,12 +181,8 @@
  479.  SUBDIRS = doc po
  480.  
  481.  docdir = doc
  482. -bfdlibdir = @bfdlibdir@
  483. -bfdincludedir = @bfdincludedir@
  484.  
  485.  bfdlib_LTLIBRARIES = libbfd.la
  486. -
  487. -WARN_CFLAGS = @WARN_CFLAGS@
  488.  AM_CFLAGS = $(WARN_CFLAGS)
  489.  
  490.  # bfd.h goes here, for now
  491. @@ -289,7 +334,10 @@
  492.  # The .o files needed by all of the 32 bit vectors that are configured into
  493.  # target_vector in targets.c if configured with --enable-targets=all.
  494.  BFD32_BACKENDS = \
  495. +    amigaos.lo \
  496. +    amigaoslink.lo \
  497.      aout-adobe.lo \
  498. +    aout-amiga.lo \
  499.      aout-arm.lo \
  500.      aout-cris.lo \
  501.      aout-ns32k.lo \
  502. @@ -338,6 +386,7 @@
  503.      elf32-arc.lo \
  504.      elfarm-oabi.lo \
  505.      elfarm-nabi.lo \
  506. +    elf32-amiga.lo \
  507.      elf32-avr.lo \
  508.      elf32-cris.lo \
  509.      elf32-d10v.lo \
  510. @@ -364,6 +413,7 @@
  511.      elf-m10200.lo \
  512.      elf-m10300.lo \
  513.      elf32-mcore.lo \
  514. +    elf32-morphos.lo \
  515.      elfxx-mips.lo \
  516.      elf32-mips.lo \
  517.      elf32-msp430.lo \
  518. @@ -454,7 +504,10 @@
  519.  
  520.  
  521.  BFD32_BACKENDS_CFILES = \
  522. +    amigaos.c \
  523. +    amigaoslink.c \
  524.      aout-adobe.c \
  525. +    aout-amiga.c \
  526.      aout-arm.c \
  527.      aout-cris.c \
  528.      aout-ns32k.c \
  529. @@ -503,6 +556,7 @@
  530.      elf32-arc.c \
  531.      elfarm-oabi.c \
  532.      elfarm-nabi.c \
  533. +    elf32-amiga.c \
  534.      elf32-avr.c \
  535.      elf32-cris.c \
  536.      elf32-d10v.c \
  537. @@ -528,6 +582,7 @@
  538.      elf-m10200.c \
  539.      elf-m10300.c \
  540.      elf32-mcore.c \
  541. +    elf32-morphos.lo \
  542.      elfxx-mips.c \
  543.      elf32-mips.c \
  544.      elf32-msp430.c \
  545. @@ -721,7 +776,7 @@
  546.      aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
  547.      elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \
  548.      elf64-hppa.h elfcode.h elfcore.h elflink.h \
  549. -    freebsd.h genlink.h go32stub.h \
  550. +    freebsd.h genlink.h go32stub.h libamiga.h \
  551.      libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
  552.      libnlm.h liboasys.h libpei.h libxcoff.h mach-o.h \
  553.      netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h \
  554. @@ -777,132 +832,119 @@
  555.  
  556.  
  557.  DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
  558. +subdir = .
  559.  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
  560.  mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
  561.  CONFIG_HEADER = config.h
  562. -CONFIG_CLEAN_FILES =  bfd-in3.h bfdver.h
  563. +CONFIG_CLEAN_FILES = bfd-in3.h bfdver.h po/Makefile.in
  564.  LIBRARIES =  $(noinst_LIBRARIES)
  565.  
  566. -
  567. -DEFS = @DEFS@ -I. -I$(srcdir) -I.
  568. -CPPFLAGS = @CPPFLAGS@
  569. -LDFLAGS = @LDFLAGS@
  570. -LIBS = @LIBS@
  571. +libbfd_a_AR = $(AR) cru
  572.  libbfd_a_LIBADD = 
  573. -libbfd_a_OBJECTS = 
  574. +am_libbfd_a_OBJECTS =
  575. +libbfd_a_OBJECTS = $(am_libbfd_a_OBJECTS)
  576.  LTLIBRARIES =  $(bfdlib_LTLIBRARIES)
  577.  
  578. -libbfd_la_OBJECTS =  archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
  579. -cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo \
  580. -reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo \
  581. -binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo \
  582. -simple.lo archive64.lo
  583. -CFLAGS = @CFLAGS@
  584. -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  585. -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  586. +am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
  587. +    cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo \
  588. +    opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo \
  589. +    linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo \
  590. +    stab-syms.lo merge.lo dwarf2.lo simple.lo
  591. +am__objects_2 = archive64.lo
  592. +am_libbfd_la_OBJECTS = $(am__objects_1) $(am__objects_2)
  593. +libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
  594. +
  595. +DEFAULT_INCLUDES =  -I. -I$(srcdir) -I.
  596. +depcomp =
  597. +am__depfiles_maybe =
  598. +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
  599. +    $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  600. +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
  601. +    $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  602.  CCLD = $(CC)
  603. -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
  604. -DIST_COMMON =  README ./stamp-h.in COPYING ChangeLog Makefile.am \
  605. -Makefile.in TODO acinclude.m4 aclocal.m4 bfd-in2.h config.in configure \
  606. -configure.in version.h
  607. -
  608. -
  609. -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
  610. -
  611. -TAR = gtar
  612. -GZIP_ENV = --best
  613. +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
  614. +    $(AM_LDFLAGS) $(LDFLAGS) -o $@
  615. +DIST_SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
  616. +
  617. +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
  618. +    ps-recursive uninstall-info-recursive all-recursive \
  619. +    install-data-recursive install-exec-recursive \
  620. +    installdirs-recursive install-recursive uninstall-recursive \
  621. +    check-recursive installcheck-recursive
  622.  SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
  623. -OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
  624.  
  625. -all: all-redirect
  626. +all: config.h
  627. +    $(MAKE) $(AM_MAKEFLAGS) all-recursive
  628. +
  629.  .SUFFIXES:
  630. -.SUFFIXES: .S .c .lo .o .obj .s
  631. +.SUFFIXES: .c .lo .o .obj
  632. +
  633. +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  634. + configure.lineno
  635.  $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
  636. -    cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
  637. +    cd $(top_srcdir) && \
  638. +      $(AUTOMAKE) --cygnus  Makefile
  639.  
  640. -Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
  641. -    cd $(top_builddir) \
  642. -      && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
  643. +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
  644. +    $(SHELL) ./config.status --recheck
  645. +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
  646. +    cd $(srcdir) && $(AUTOCONF)
  647.  
  648.  $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in  acinclude.m4
  649. -    cd $(srcdir) && $(ACLOCAL)
  650. -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
  651. -    cd $(srcdir) && $(AUTOCONF)
  652. +    cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
  653.  
  654. -config.h: stamp-h
  655. -    @if test ! -f $@; then \
  656. -        rm -f stamp-h; \
  657. -        $(MAKE) stamp-h; \
  658. -    else :; fi
  659. -stamp-h: $(srcdir)/config.in $(top_builddir)/config.status
  660. -    cd $(top_builddir) \
  661. -      && CONFIG_FILES= CONFIG_HEADERS=config.h:config.in \
  662. -         $(SHELL) ./config.status
  663. -    @echo timestamp > stamp-h 2> /dev/null
  664. -$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
  665. +config.h: stamp-h1
  666.      @if test ! -f $@; then \
  667. -        rm -f $(srcdir)/stamp-h.in; \
  668. -        $(MAKE) $(srcdir)/stamp-h.in; \
  669. +      rm -f stamp-h1; \
  670. +      $(MAKE) stamp-h1; \
  671.      else :; fi
  672. -$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) 
  673. -    cd $(top_srcdir) && $(AUTOHEADER)
  674. -    @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
  675.  
  676. -mostlyclean-hdr:
  677. +stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status
  678. +    @rm -f stamp-h1
  679. +    cd $(top_builddir) && $(SHELL) ./config.status config.h
  680.  
  681. -clean-hdr:
  682. +$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) 
  683. +    cd $(top_srcdir) && $(AUTOHEADER)
  684. +    touch $(srcdir)/config.in
  685.  
  686.  distclean-hdr:
  687. -    -rm -f config.h
  688. -
  689. -maintainer-clean-hdr:
  690. +    -rm -f config.h stamp-h1
  691.  bfd-in3.h: $(top_builddir)/config.status bfd-in2.h
  692. -    cd $(top_builddir) && CONFIG_FILES=$@:bfd-in2.h CONFIG_HEADERS= $(SHELL) ./config.status
  693. +    cd $(top_builddir) && $(SHELL) ./config.status $@
  694.  bfdver.h: $(top_builddir)/config.status version.h
  695. -    cd $(top_builddir) && CONFIG_FILES=$@:version.h CONFIG_HEADERS= $(SHELL) ./config.status
  696. -
  697. -mostlyclean-noinstLIBRARIES:
  698. +    cd $(top_builddir) && $(SHELL) ./config.status $@
  699. +po/Makefile.in: $(top_builddir)/config.status $(top_srcdir)/po/Make-in
  700. +    cd $(top_builddir) && $(SHELL) ./config.status $@
  701.  
  702.  clean-noinstLIBRARIES:
  703.      -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
  704. +bfdlibLTLIBRARIES_INSTALL = $(INSTALL)
  705.  
  706. -distclean-noinstLIBRARIES:
  707. -
  708. -maintainer-clean-noinstLIBRARIES:
  709. -
  710. -.c.o:
  711. -    $(COMPILE) -c $<
  712. -
  713. -# FIXME: We should only use cygpath when building on Windows,
  714. -# and only if it is available.
  715. -.c.obj:
  716. -    $(COMPILE) -c `cygpath -w $<`
  717. -
  718. -.s.o:
  719. -    $(COMPILE) -c $<
  720. -
  721. -.S.o:
  722. -    $(COMPILE) -c $<
  723. +clean-bfdlibLTLIBRARIES:
  724. +    -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES)
  725. +    @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
  726. +      dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
  727. +      test "$$dir" = "$$p" && dir=.; \
  728. +      echo "rm -f \"$${dir}/so_locations\""; \
  729. +      rm -f "$${dir}/so_locations"; \
  730. +    done
  731. +libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES) 
  732. +    $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
  733.  
  734.  mostlyclean-compile:
  735. -    -rm -f *.o core *.core
  736. -    -rm -f *.$(OBJEXT)
  737. -
  738. -clean-compile:
  739. +    -rm -f *.$(OBJEXT) core *.core
  740.  
  741.  distclean-compile:
  742.      -rm -f *.tab.c
  743.  
  744. -maintainer-clean-compile:
  745. -
  746. -.c.lo:
  747. -    $(LIBTOOL) --mode=compile $(COMPILE) -c $<
  748. +.c.o:
  749. +    $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
  750.  
  751. -.s.lo:
  752. -    $(LIBTOOL) --mode=compile $(COMPILE) -c $<
  753. +.c.obj:
  754. +    $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
  755.  
  756. -.S.lo:
  757. -    $(LIBTOOL) --mode=compile $(COMPILE) -c $<
  758. +.c.lo:
  759. +    $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
  760.  
  761.  mostlyclean-libtool:
  762.      -rm -f *.lo
  763. @@ -911,20 +953,8 @@
  764.      -rm -rf .libs _libs
  765.  
  766.  distclean-libtool:
  767. -
  768. -maintainer-clean-libtool:
  769. -
  770. -mostlyclean-bfdlibLTLIBRARIES:
  771. -
  772. -clean-bfdlibLTLIBRARIES:
  773. -    -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES)
  774. -
  775. -distclean-bfdlibLTLIBRARIES:
  776. -
  777. -maintainer-clean-bfdlibLTLIBRARIES:
  778. -
  779. -libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
  780. -    $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
  781. +    -rm -f libtool
  782. +uninstall-info-am:
  783.  
  784.  # This directory's subdirectories are mostly independent; you can cd
  785.  # into them and run `make' without going through this Makefile.
  786. @@ -932,13 +962,8 @@
  787.  # (1) if the variable is set in `config.status', edit `config.status'
  788.  #     (which will cause the Makefiles to be regenerated when you run `make');
  789.  # (2) otherwise, pass the desired values on the `make' command line.
  790. -
  791. -@SET_MAKE@
  792. -
  793. -all-recursive install-data-recursive install-exec-recursive \
  794. -installdirs-recursive install-recursive uninstall-recursive install-info-recursive \
  795. -check-recursive installcheck-recursive info-recursive dvi-recursive:
  796. -    @set fnord $(MAKEFLAGS); amf=$$2; \
  797. +$(RECURSIVE_TARGETS):
  798. +    @set fnord $$MAKEFLAGS; amf=$$2; \
  799.      dot_seen=no; \
  800.      target=`echo $@ | sed s/-recursive//`; \
  801.      list='$(SUBDIRS)'; for subdir in $$list; do \
  802. @@ -958,13 +983,18 @@
  803.  
  804.  mostlyclean-recursive clean-recursive distclean-recursive \
  805.  maintainer-clean-recursive:
  806. -    @set fnord $(MAKEFLAGS); amf=$$2; \
  807. +    @set fnord $$MAKEFLAGS; amf=$$2; \
  808.      dot_seen=no; \
  809. -    rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
  810. +    case "$@" in \
  811. +      distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
  812. +      *) list='$(SUBDIRS)' ;; \
  813. +    esac; \
  814. +    rev=''; for subdir in $$list; do \
  815. +      if test "$$subdir" = "."; then :; else \
  816.        rev="$$subdir $$rev"; \
  817. -      test "$$subdir" != "." || dot_seen=yes; \
  818. +      fi; \
  819.      done; \
  820. -    test "$$dot_seen" = "no" && rev=". $$rev"; \
  821. +    rev="$$rev ."; \
  822.      target=`echo $@ | sed s/-recursive//`; \
  823.      for subdir in $$rev; do \
  824.        echo "Making $$target in $$subdir"; \
  825. @@ -980,132 +1010,96 @@
  826.      list='$(SUBDIRS)'; for subdir in $$list; do \
  827.        test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
  828.      done
  829. +ctags-recursive:
  830. +    list='$(SUBDIRS)'; for subdir in $$list; do \
  831. +      test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
  832. +    done
  833. +
  834. +ETAGS = etags
  835. +ETAGSFLAGS =
  836. +
  837. +CTAGS = ctags
  838. +CTAGSFLAGS =
  839.  
  840.  tags: TAGS
  841.  
  842. -ID: $(HEADERS) $(SOURCES) $(LISP)
  843. -    list='$(SOURCES) $(HEADERS)'; \
  844. -    unique=`for i in $$list; do echo $$i; done | \
  845. -      awk '    { files[$$0] = 1; } \
  846. +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
  847. +    list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
  848. +    unique=`for i in $$list; do \
  849. +        if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  850. +      done | \
  851. +      $(AWK) '    { files[$$0] = 1; } \
  852.             END { for (i in files) print i; }'`; \
  853. -    here=`pwd` && cd $(srcdir) \
  854. -      && mkid -f$$here/ID $$unique $(LISP)
  855. +    mkid -fID $$unique
  856.  
  857. -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP)
  858. +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
  859. +        $(TAGS_FILES) $(LISP)
  860.      tags=; \
  861.      here=`pwd`; \
  862. +    if (etags --etags-include --version) >/dev/null 2>&1; then \
  863. +      include_option=--etags-include; \
  864. +    else \
  865. +      include_option=--include; \
  866. +    fi; \
  867.      list='$(SUBDIRS)'; for subdir in $$list; do \
  868.     if test "$$subdir" = .; then :; else \
  869. -        test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
  870. +        test -f $$subdir/TAGS && \
  871. +          tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
  872.     fi; \
  873.      done; \
  874. -    list='$(SOURCES) $(HEADERS)'; \
  875. -    unique=`for i in $$list; do echo $$i; done | \
  876. -      awk '    { files[$$0] = 1; } \
  877. +    list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \
  878. +    unique=`for i in $$list; do \
  879. +        if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  880. +      done | \
  881. +      $(AWK) '    { files[$$0] = 1; } \
  882.             END { for (i in files) print i; }'`; \
  883. -    test -z "$(ETAGS_ARGS)config.in$$unique$(LISP)$$tags" \
  884. -      || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.in $$unique $(LISP) -o $$here/TAGS)
  885. -
  886. -mostlyclean-tags:
  887. -
  888. -clean-tags:
  889. +    test -z "$(ETAGS_ARGS)$$tags$$unique" \
  890. +      || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
  891. +         $$tags $$unique
  892. +
  893. +ctags: CTAGS
  894. +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
  895. +        $(TAGS_FILES) $(LISP)
  896. +    tags=; \
  897. +    here=`pwd`; \
  898. +    list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \
  899. +    unique=`for i in $$list; do \
  900. +        if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  901. +      done | \
  902. +      $(AWK) '    { files[$$0] = 1; } \
  903. +           END { for (i in files) print i; }'`; \
  904. +    test -z "$(CTAGS_ARGS)$$tags$$unique" \
  905. +      || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
  906. +         $$tags $$unique
  907. +
  908. +GTAGS:
  909. +    here=`$(am__cd) $(top_builddir) && pwd` \
  910. +      && cd $(top_srcdir) \
  911. +      && gtags -i $(GTAGS_ARGS) $$here
  912.  
  913.  distclean-tags:
  914. -    -rm -f TAGS ID
  915. -
  916. -maintainer-clean-tags:
  917. -
  918. -distdir = $(PACKAGE)-$(VERSION)
  919. -top_distdir = $(distdir)
  920. -
  921. -# This target untars the dist file and tries a VPATH configuration.  Then
  922. -# it guarantees that the distribution is self-contained by making another
  923. -# tarfile.
  924. -distcheck: dist
  925. -    -rm -rf $(distdir)
  926. -    GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
  927. -    mkdir $(distdir)/=build
  928. -    mkdir $(distdir)/=inst
  929. -    dc_install_base=`cd $(distdir)/=inst && pwd`; \
  930. -    cd $(distdir)/=build \
  931. -      && ../configure --srcdir=.. --prefix=$$dc_install_base \
  932. -      && $(MAKE) $(AM_MAKEFLAGS) \
  933. -      && $(MAKE) $(AM_MAKEFLAGS) dvi \
  934. -      && $(MAKE) $(AM_MAKEFLAGS) check \
  935. -      && $(MAKE) $(AM_MAKEFLAGS) install \
  936. -      && $(MAKE) $(AM_MAKEFLAGS) installcheck \
  937. -      && $(MAKE) $(AM_MAKEFLAGS) dist
  938. -    -rm -rf $(distdir)
  939. -    @banner="$(distdir).tar.gz is ready for distribution"; \
  940. -    dashes=`echo "$$banner" | sed s/./=/g`; \
  941. -    echo "$$dashes"; \
  942. -    echo "$$banner"; \
  943. -    echo "$$dashes"
  944. -dist: distdir
  945. -    -chmod -R a+r $(distdir)
  946. -    GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
  947. -    -rm -rf $(distdir)
  948. -dist-all: distdir
  949. -    -chmod -R a+r $(distdir)
  950. -    GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
  951. -    -rm -rf $(distdir)
  952. -distdir: $(DISTFILES)
  953. -    -rm -rf $(distdir)
  954. -    mkdir $(distdir)
  955. -    -chmod 777 $(distdir)
  956. -    @for file in $(DISTFILES); do \
  957. -      if test -f $$file; then d=.; else d=$(srcdir); fi; \
  958. -      if test -d $$d/$$file; then \
  959. -        cp -pr $$d/$$file $(distdir)/$$file; \
  960. -      else \
  961. -        test -f $(distdir)/$$file \
  962. -        || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
  963. -        || cp -p $$d/$$file $(distdir)/$$file || :; \
  964. -      fi; \
  965. -    done
  966. -    for subdir in $(SUBDIRS); do \
  967. -      if test "$$subdir" = .; then :; else \
  968. -        test -d $(distdir)/$$subdir \
  969. -        || mkdir $(distdir)/$$subdir \
  970. -        || exit 1; \
  971. -        chmod 777 $(distdir)/$$subdir; \
  972. -        (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
  973. -          || exit 1; \
  974. -      fi; \
  975. -    done
  976. -info-am:
  977. -info: info-recursive
  978. -dvi-am:
  979. -dvi: dvi-recursive
  980. +    -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
  981.  check-am:
  982.  check: check-recursive
  983. -installcheck-am:
  984. -installcheck: installcheck-recursive
  985. -install-info-am: 
  986. -install-info: install-info-recursive
  987. -all-recursive-am: config.h
  988. -    $(MAKE) $(AM_MAKEFLAGS) all-recursive
  989. +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
  990. +installdirs: installdirs-recursive
  991. +installdirs-am:
  992. +    $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
  993.  
  994. -install-exec-am:
  995. +install: install-recursive
  996.  install-exec: install-exec-recursive
  997. -
  998. -install-data-am: install-bfdlibLTLIBRARIES
  999.  install-data: install-data-recursive
  1000. +uninstall: uninstall-recursive
  1001.  
  1002.  install-am: all-am
  1003.      @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
  1004. -install: install-recursive
  1005. -uninstall-am: uninstall-bfdlibLTLIBRARIES
  1006. -uninstall: uninstall-recursive
  1007. -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
  1008. -all-redirect: all-recursive-am
  1009. -install-strip:
  1010. -    $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
  1011. -installdirs: installdirs-recursive
  1012. -installdirs-am:
  1013. -    $(mkinstalldirs)  $(DESTDIR)$(bfdlibdir)
  1014. -
  1015.  
  1016. +installcheck: installcheck-recursive
  1017. +install-strip:
  1018. +    $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
  1019. +      INSTALL_STRIP_FLAG=-s \
  1020. +      `test -z '$(STRIP)' || \
  1021. +        echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
  1022.  mostlyclean-generic:
  1023.      -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
  1024.  
  1025. @@ -1114,64 +1108,79 @@
  1026.  
  1027.  distclean-generic:
  1028.      -rm -f Makefile $(CONFIG_CLEAN_FILES)
  1029. -    -rm -f config.cache config.log stamp-h stamp-h[0-9]*
  1030.      -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
  1031.  
  1032.  maintainer-clean-generic:
  1033. -mostlyclean-am:  mostlyclean-hdr mostlyclean-noinstLIBRARIES \
  1034. -        mostlyclean-compile mostlyclean-libtool \
  1035. -        mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \
  1036. -        mostlyclean-generic
  1037. +    @echo "This command is intended for maintainers to use"
  1038. +    @echo "it deletes files that may require special tools to rebuild."
  1039. +clean: clean-recursive
  1040.  
  1041. -mostlyclean: mostlyclean-recursive
  1042. +clean-am: clean-bfdlibLTLIBRARIES clean-generic clean-libtool \
  1043. +    clean-noinstLIBRARIES mostlyclean-am
  1044.  
  1045. -clean-am:  clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \
  1046. -        clean-bfdlibLTLIBRARIES clean-tags clean-generic \
  1047. -        mostlyclean-am
  1048. +distclean: distclean-recursive
  1049. +    -rm -f $(am__CONFIG_DISTCLEAN_FILES)
  1050. +distclean-am: clean-am distclean-compile distclean-generic distclean-hdr \
  1051. +    distclean-libtool distclean-tags
  1052.  
  1053. -clean: clean-recursive
  1054. +dvi: dvi-recursive
  1055.  
  1056. -distclean-am:  distclean-hdr distclean-noinstLIBRARIES distclean-compile \
  1057. -        distclean-libtool distclean-bfdlibLTLIBRARIES \
  1058. -        distclean-tags distclean-generic clean-am
  1059. -    -rm -f libtool
  1060. +dvi-am:
  1061.  
  1062. -distclean: distclean-recursive
  1063. -    -rm -f config.status
  1064. +info: info-recursive
  1065.  
  1066. -maintainer-clean-am:  maintainer-clean-hdr \
  1067. -        maintainer-clean-noinstLIBRARIES \
  1068. -        maintainer-clean-compile maintainer-clean-libtool \
  1069. -        maintainer-clean-bfdlibLTLIBRARIES \
  1070. -        maintainer-clean-tags maintainer-clean-generic \
  1071. -        distclean-am
  1072. -    @echo "This command is intended for maintainers to use;"
  1073. -    @echo "it deletes files that may require special tools to rebuild."
  1074. +info-am:
  1075. +
  1076. +install-data-am: install-bfdlibLTLIBRARIES
  1077. +
  1078. +install-exec-am:
  1079. +
  1080. +install-info:
  1081. +
  1082. +install-man:
  1083. +
  1084. +installcheck-am:
  1085.  
  1086.  maintainer-clean: maintainer-clean-recursive
  1087. -    -rm -f config.status
  1088. +    -rm -f $(am__CONFIG_DISTCLEAN_FILES)
  1089. +    -rm -rf autom4te.cache
  1090. +maintainer-clean-am: distclean-am maintainer-clean-generic
  1091.  
  1092. -.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
  1093. -mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
  1094. -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
  1095. -mostlyclean-compile distclean-compile clean-compile \
  1096. -maintainer-clean-compile mostlyclean-libtool distclean-libtool \
  1097. -clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \
  1098. -distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \
  1099. -maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \
  1100. -install-bfdlibLTLIBRARIES install-data-recursive \
  1101. -uninstall-data-recursive install-exec-recursive \
  1102. -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
  1103. -all-recursive check-recursive installcheck-recursive info-recursive \
  1104. -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
  1105. -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
  1106. -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
  1107. -dvi-am dvi check check-am installcheck-am installcheck install-info-am \
  1108. -install-info all-recursive-am install-exec-am install-exec \
  1109. -install-data-am install-data install-am install uninstall-am uninstall \
  1110. -all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
  1111. -distclean-generic clean-generic maintainer-clean-generic clean \
  1112. -mostlyclean distclean maintainer-clean
  1113. +mostlyclean: mostlyclean-recursive
  1114. +
  1115. +mostlyclean-am: mostlyclean-compile mostlyclean-generic \
  1116. +    mostlyclean-libtool
  1117. +
  1118. +pdf: pdf-recursive
  1119. +
  1120. +pdf-am:
  1121. +
  1122. +ps: ps-recursive
  1123. +
  1124. +ps-am:
  1125. +
  1126. +uninstall-am: uninstall-bfdlibLTLIBRARIES
  1127. +
  1128. +uninstall-info: uninstall-info-recursive
  1129. +
  1130. +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
  1131. +    clean-bfdlibLTLIBRARIES clean-generic clean-libtool \
  1132. +    clean-noinstLIBRARIES clean-recursive ctags ctags-recursive \
  1133. +    distclean distclean-compile distclean-generic distclean-hdr \
  1134. +    distclean-libtool distclean-recursive distclean-tags dvi dvi-am \
  1135. +    dvi-recursive info info-am info-recursive install install-am \
  1136. +    install-bfdlibLTLIBRARIES install-data install-data-am \
  1137. +    install-data-recursive install-exec install-exec-am \
  1138. +    install-exec-recursive install-info install-info-am install-man \
  1139. +    install-recursive install-strip installcheck installcheck-am \
  1140. +    installdirs installdirs-am installdirs-recursive \
  1141. +    maintainer-clean maintainer-clean-generic \
  1142. +    maintainer-clean-recursive mostlyclean mostlyclean-compile \
  1143. +    mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
  1144. +    pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
  1145. +    tags-recursive uninstall uninstall-am \
  1146. +    uninstall-bfdlibLTLIBRARIES uninstall-info-am \
  1147. +    uninstall-info-recursive uninstall-recursive
  1148.  
  1149.  
  1150.  po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
  1151. @@ -1502,6 +1511,9 @@
  1152.  cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
  1153.  cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
  1154.  cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
  1155. +amigaos.lo: amigaos.c libamiga.h bfd.h
  1156. +amigaoslink.lo: bfd.h libamiga.h amigaoslink.c
  1157. +aout-amiga.lo: aout-amiga.c aoutf1.h bfd.h
  1158.  aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
  1159.    $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
  1160.    $(INCDIR)/bfdlink.h
  1161. @@ -1655,6 +1667,10 @@
  1162.  elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  1163.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  1164.    $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
  1165. +elf32-amiga.lo: elf32-amiga.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  1166. +  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  1167. +  $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
  1168. +  elf32-target.h
  1169.  elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
  1170.    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  1171.    $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
  1172. @@ -1714,6 +1730,10 @@
  1173.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  1174.    $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
  1175.    elf32-target.h
  1176. +elf32-i386-amithlon.lo: elf32-i386-amithlon.c elf32-i386.c $(INCDIR)/filenames.h \
  1177. +  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
  1178. +  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
  1179. +  $(INCDIR)/elf/reloc-macros.h elf32-target.h
  1180.  elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
  1181.    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  1182.    $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
  1183. @@ -1795,6 +1815,10 @@
  1184.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  1185.    $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h \
  1186.    elf32-target.h
  1187. +elf32-morphos.lo: elf32-morphos.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  1188. +  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  1189. +  $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
  1190. +  elf32-target.h
  1191.  elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
  1192.    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  1193.    $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
  1194. diff -urNEBb binutils-2.14-orig/bfd/aclocal.m4 binutils-2.14/bfd/aclocal.m4
  1195. --- binutils-2.14-orig/bfd/aclocal.m4    2003-05-02 18:06:14.000000000 +0200
  1196. +++ binutils-2.14/bfd/aclocal.m4    2003-12-02 14:09:39.000000000 +0100
  1197. @@ -1,14 +1,15 @@
  1198. -dnl aclocal.m4 generated automatically by aclocal 1.4-p5
  1199. +# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
  1200.  
  1201. -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
  1202. -dnl This file is free software; the Free Software Foundation
  1203. -dnl gives unlimited permission to copy and/or distribute it,
  1204. -dnl with or without modifications, as long as this notice is preserved.
  1205. -
  1206. -dnl This program is distributed in the hope that it will be useful,
  1207. -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  1208. -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  1209. -dnl PARTICULAR PURPOSE.
  1210. +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
  1211. +# Free Software Foundation, Inc.
  1212. +# This file is free software; the Free Software Foundation
  1213. +# gives unlimited permission to copy and/or distribute it,
  1214. +# with or without modifications, as long as this notice is preserved.
  1215. +
  1216. +# This program is distributed in the hope that it will be useful,
  1217. +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  1218. +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  1219. +# PARTICULAR PURPOSE.
  1220.  
  1221.  dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
  1222.  AC_DEFUN(BFD_BINARY_FOPEN,
  1223. @@ -160,18 +161,76 @@
  1224.  ]
  1225.  )
  1226.  
  1227. -# Define a conditional.
  1228. +# AM_CONDITIONAL                                              -*- Autoconf -*-
  1229. +
  1230. +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
  1231. +
  1232. +# This program is free software; you can redistribute it and/or modify
  1233. +# it under the terms of the GNU General Public License as published by
  1234. +# the Free Software Foundation; either version 2, or (at your option)
  1235. +# any later version.
  1236. +
  1237. +# This program is distributed in the hope that it will be useful,
  1238. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1239. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1240. +# GNU General Public License for more details.
  1241. +
  1242. +# You should have received a copy of the GNU General Public License
  1243. +# along with this program; if not, write to the Free Software
  1244. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1245. +# 02111-1307, USA.
  1246. +
  1247. +# serial 5
  1248. +
  1249. +AC_PREREQ(2.52)
  1250.  
  1251. +# AM_CONDITIONAL(NAME, SHELL-CONDITION)
  1252. +# -------------------------------------
  1253. +# Define a conditional.
  1254.  AC_DEFUN([AM_CONDITIONAL],
  1255. -[AC_SUBST($1_TRUE)
  1256. -AC_SUBST($1_FALSE)
  1257. +[ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
  1258. +        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
  1259. +AC_SUBST([$1_TRUE])
  1260. +AC_SUBST([$1_FALSE])
  1261.  if $2; then
  1262.    $1_TRUE=
  1263.    $1_FALSE='#'
  1264.  else
  1265.    $1_TRUE='#'
  1266.    $1_FALSE=
  1267. -fi])
  1268. +fi
  1269. +AC_CONFIG_COMMANDS_PRE(
  1270. +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
  1271. +  AC_MSG_ERROR([conditional \"$1\" was never defined.
  1272. +Usually this means the macro was only invoked conditionally.])
  1273. +fi])])
  1274. +
  1275. +# isc-posix.m4 serial 2 (gettext-0.11.2)
  1276. +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
  1277. +dnl This file is free software, distributed under the terms of the GNU
  1278. +dnl General Public License.  As a special exception to the GNU General
  1279. +dnl Public License, this file may be distributed as part of a program
  1280. +dnl that contains a configuration script generated by Autoconf, under
  1281. +dnl the same distribution terms as the rest of that program.
  1282. +
  1283. +# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
  1284. +
  1285. +# This test replaces the one in autoconf.
  1286. +# Currently this macro should have the same name as the autoconf macro
  1287. +# because gettext's gettext.m4 (distributed in the automake package)
  1288. +# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
  1289. +# give these diagnostics:
  1290. +#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
  1291. +#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
  1292. +
  1293. +undefine([AC_ISC_POSIX])
  1294. +
  1295. +AC_DEFUN([AC_ISC_POSIX],
  1296. +  [
  1297. +    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
  1298. +    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
  1299. +  ]
  1300. +)
  1301.  
  1302.  #serial 1
  1303.  # This test replaces the one in autoconf.
  1304. @@ -195,57 +254,221 @@
  1305.  # some checks are only needed if your package does certain things.
  1306.  # But this isn't really a big deal.
  1307.  
  1308. -# serial 1
  1309. +# This macro actually does too much some checks are only needed if
  1310. +# your package does certain things.  But this isn't really a big deal.
  1311.  
  1312. -dnl Usage:
  1313. -dnl AM_INIT_AUTOMAKE(package,version, [no-define])
  1314. +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
  1315. +# Free Software Foundation, Inc.
  1316.  
  1317. +# This program is free software; you can redistribute it and/or modify
  1318. +# it under the terms of the GNU General Public License as published by
  1319. +# the Free Software Foundation; either version 2, or (at your option)
  1320. +# any later version.
  1321. +
  1322. +# This program is distributed in the hope that it will be useful,
  1323. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1324. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1325. +# GNU General Public License for more details.
  1326. +
  1327. +# You should have received a copy of the GNU General Public License
  1328. +# along with this program; if not, write to the Free Software
  1329. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1330. +# 02111-1307, USA.
  1331. +
  1332. +# serial 8
  1333. +
  1334. +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
  1335. +# written in clear, in which case automake, when reading aclocal.m4,
  1336. +# will think it sees a *use*, and therefore will trigger all it's
  1337. +# C support machinery.  Also note that it means that autoscan, seeing
  1338. +# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
  1339. +
  1340. +
  1341. +AC_PREREQ([2.52])
  1342. +
  1343. +# Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
  1344. +# the ones we care about.
  1345. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
  1346. +
  1347. +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
  1348. +# AM_INIT_AUTOMAKE([OPTIONS])
  1349. +# -----------------------------------------------
  1350. +# The call with PACKAGE and VERSION arguments is the old style
  1351. +# call (pre autoconf-2.50), which is being phased out.  PACKAGE
  1352. +# and VERSION should now be passed to AC_INIT and removed from
  1353. +# the call to AM_INIT_AUTOMAKE.
  1354. +# We support both call styles for the transition.  After
  1355. +# the next Automake release, Autoconf can make the AC_INIT
  1356. +# arguments mandatory, and then we can depend on a new Autoconf
  1357. +# release and drop the old call support.
  1358.  AC_DEFUN([AM_INIT_AUTOMAKE],
  1359. -[AC_REQUIRE([AC_PROG_INSTALL])
  1360. -PACKAGE=[$1]
  1361. -AC_SUBST(PACKAGE)
  1362. -VERSION=[$2]
  1363. -AC_SUBST(VERSION)
  1364. -dnl test to see if srcdir already configured
  1365. -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  1366. +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
  1367. + AC_REQUIRE([AC_PROG_INSTALL])dnl
  1368. +# test to see if srcdir already configured
  1369. +if test "`cd $srcdir && pwd`" != "`pwd`" &&
  1370. +   test -f $srcdir/config.status; then
  1371.    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
  1372.  fi
  1373. -ifelse([$3],,
  1374. -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
  1375. -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
  1376. -AC_REQUIRE([AM_SANITY_CHECK])
  1377. -AC_REQUIRE([AC_ARG_PROGRAM])
  1378. -dnl FIXME This is truly gross.
  1379. -missing_dir=`cd $ac_aux_dir && pwd`
  1380. -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
  1381. -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
  1382. -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
  1383. -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
  1384. -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
  1385. -AC_REQUIRE([AC_PROG_MAKE_SET])])
  1386. +
  1387. +# Define the identity of the package.
  1388. +dnl Distinguish between old-style and new-style calls.
  1389. +m4_ifval([$2],
  1390. +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  1391. + AC_SUBST([PACKAGE], [$1])dnl
  1392. + AC_SUBST([VERSION], [$2])],
  1393. +[_AM_SET_OPTIONS([$1])dnl
  1394. + AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
  1395. + AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
  1396. +
  1397. +_AM_IF_OPTION([no-define],,
  1398. +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
  1399. + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
  1400. +
  1401. +# Some tools Automake needs.
  1402. +AC_REQUIRE([AM_SANITY_CHECK])dnl
  1403. +AC_REQUIRE([AC_ARG_PROGRAM])dnl
  1404. +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
  1405. +AM_MISSING_PROG(AUTOCONF, autoconf)
  1406. +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
  1407. +AM_MISSING_PROG(AUTOHEADER, autoheader)
  1408. +AM_MISSING_PROG(MAKEINFO, makeinfo)
  1409. +AM_MISSING_PROG(AMTAR, tar)
  1410. +AM_PROG_INSTALL_SH
  1411. +AM_PROG_INSTALL_STRIP
  1412. +# We need awk for the "check" target.  The system "awk" is bad on
  1413. +# some platforms.
  1414. +AC_REQUIRE([AC_PROG_AWK])dnl
  1415. +AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  1416. +
  1417. +_AM_IF_OPTION([no-dependencies],,
  1418. +[AC_PROVIDE_IFELSE([AC_PROG_][CC],
  1419. +                  [_AM_DEPENDENCIES(CC)],
  1420. +                  [define([AC_PROG_][CC],
  1421. +                          defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
  1422. +AC_PROVIDE_IFELSE([AC_PROG_][CXX],
  1423. +                  [_AM_DEPENDENCIES(CXX)],
  1424. +                  [define([AC_PROG_][CXX],
  1425. +                          defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
  1426. +])
  1427. +])
  1428. +
  1429. +# Copyright 2002  Free Software Foundation, Inc.
  1430. +
  1431. +# This program is free software; you can redistribute it and/or modify
  1432. +# it under the terms of the GNU General Public License as published by
  1433. +# the Free Software Foundation; either version 2, or (at your option)
  1434. +# any later version.
  1435. +
  1436. +# This program is distributed in the hope that it will be useful,
  1437. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1438. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1439. +# GNU General Public License for more details.
  1440. +
  1441. +# You should have received a copy of the GNU General Public License
  1442. +# along with this program; if not, write to the Free Software
  1443. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1444. +
  1445. +# AM_AUTOMAKE_VERSION(VERSION)
  1446. +# ----------------------------
  1447. +# Automake X.Y traces this macro to ensure aclocal.m4 has been
  1448. +# generated from the m4 files accompanying Automake X.Y.
  1449. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"])
  1450. +
  1451. +# AM_SET_CURRENT_AUTOMAKE_VERSION
  1452. +# -------------------------------
  1453. +# Call AM_AUTOMAKE_VERSION so it can be traced.
  1454. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
  1455. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
  1456. +     [AM_AUTOMAKE_VERSION([1.6.3])])
  1457. +
  1458. +# Helper functions for option handling.                    -*- Autoconf -*-
  1459. +
  1460. +# Copyright 2001, 2002  Free Software Foundation, Inc.
  1461. +
  1462. +# This program is free software; you can redistribute it and/or modify
  1463. +# it under the terms of the GNU General Public License as published by
  1464. +# the Free Software Foundation; either version 2, or (at your option)
  1465. +# any later version.
  1466. +
  1467. +# This program is distributed in the hope that it will be useful,
  1468. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1469. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1470. +# GNU General Public License for more details.
  1471. +
  1472. +# You should have received a copy of the GNU General Public License
  1473. +# along with this program; if not, write to the Free Software
  1474. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1475. +# 02111-1307, USA.
  1476. +
  1477. +# serial 2
  1478. +
  1479. +# _AM_MANGLE_OPTION(NAME)
  1480. +# -----------------------
  1481. +AC_DEFUN([_AM_MANGLE_OPTION],
  1482. +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
  1483. +
  1484. +# _AM_SET_OPTION(NAME)
  1485. +# ------------------------------
  1486. +# Set option NAME.  Presently that only means defining a flag for this option.
  1487. +AC_DEFUN([_AM_SET_OPTION],
  1488. +[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
  1489. +
  1490. +# _AM_SET_OPTIONS(OPTIONS)
  1491. +# ----------------------------------
  1492. +# OPTIONS is a space-separated list of Automake options.
  1493. +AC_DEFUN([_AM_SET_OPTIONS],
  1494. +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
  1495. +
  1496. +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
  1497. +# -------------------------------------------
  1498. +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
  1499. +AC_DEFUN([_AM_IF_OPTION],
  1500. +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
  1501.  
  1502.  #
  1503.  # Check to make sure that the build environment is sane.
  1504.  #
  1505.  
  1506. +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
  1507. +
  1508. +# This program is free software; you can redistribute it and/or modify
  1509. +# it under the terms of the GNU General Public License as published by
  1510. +# the Free Software Foundation; either version 2, or (at your option)
  1511. +# any later version.
  1512. +
  1513. +# This program is distributed in the hope that it will be useful,
  1514. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1515. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1516. +# GNU General Public License for more details.
  1517. +
  1518. +# You should have received a copy of the GNU General Public License
  1519. +# along with this program; if not, write to the Free Software
  1520. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1521. +# 02111-1307, USA.
  1522. +
  1523. +# serial 3
  1524. +
  1525. +# AM_SANITY_CHECK
  1526. +# ---------------
  1527.  AC_DEFUN([AM_SANITY_CHECK],
  1528.  [AC_MSG_CHECKING([whether build environment is sane])
  1529.  # Just in case
  1530.  sleep 1
  1531. -echo timestamp > conftestfile
  1532. +echo timestamp > conftest.file
  1533.  # Do `set' in a subshell so we don't clobber the current shell's
  1534.  # arguments.  Must try -L first in case configure is actually a
  1535.  # symlink; some systems play weird games with the mod time of symlinks
  1536.  # (eg FreeBSD returns the mod time of the symlink's containing
  1537.  # directory).
  1538.  if (
  1539. -   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
  1540. -   if test "[$]*" = "X"; then
  1541. +   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
  1542. +   if test "$[*]" = "X"; then
  1543.        # -L didn't work.
  1544. -      set X `ls -t $srcdir/configure conftestfile`
  1545. +      set X `ls -t $srcdir/configure conftest.file`
  1546.     fi
  1547. -   if test "[$]*" != "X $srcdir/configure conftestfile" \
  1548. -      && test "[$]*" != "X conftestfile $srcdir/configure"; then
  1549. +   rm -f conftest.file
  1550. +   if test "$[*]" != "X $srcdir/configure conftest.file" \
  1551. +      && test "$[*]" != "X conftest.file $srcdir/configure"; then
  1552.  
  1553.        # If neither matched, then we have a broken ls.  This can happen
  1554.        # if, for instance, CONFIG_SHELL is bash and it inherits a
  1555. @@ -255,7 +478,7 @@
  1556.  alias in your environment])
  1557.     fi
  1558.  
  1559. -   test "[$]2" = conftestfile
  1560. +   test "$[2]" = conftest.file
  1561.     )
  1562.  then
  1563.     # Ok.
  1564. @@ -264,51 +487,570 @@
  1565.     AC_MSG_ERROR([newly created file is older than distributed files!
  1566.  Check your system clock])
  1567.  fi
  1568. -rm -f conftest*
  1569.  AC_MSG_RESULT(yes)])
  1570.  
  1571. -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
  1572. -dnl The program must properly implement --version.
  1573. +#  -*- Autoconf -*-
  1574. +
  1575. +
  1576. +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
  1577. +
  1578. +# This program is free software; you can redistribute it and/or modify
  1579. +# it under the terms of the GNU General Public License as published by
  1580. +# the Free Software Foundation; either version 2, or (at your option)
  1581. +# any later version.
  1582. +
  1583. +# This program is distributed in the hope that it will be useful,
  1584. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1585. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1586. +# GNU General Public License for more details.
  1587. +
  1588. +# You should have received a copy of the GNU General Public License
  1589. +# along with this program; if not, write to the Free Software
  1590. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1591. +# 02111-1307, USA.
  1592. +
  1593. +# serial 3
  1594. +
  1595. +# AM_MISSING_PROG(NAME, PROGRAM)
  1596. +# ------------------------------
  1597.  AC_DEFUN([AM_MISSING_PROG],
  1598. -[AC_MSG_CHECKING(for working $2)
  1599. -# Run test in a subshell; some versions of sh will print an error if
  1600. -# an executable is not found, even if stderr is redirected.
  1601. -# Redirect stdin to placate older versions of autoconf.  Sigh.
  1602. -if ($2 --version) < /dev/null > /dev/null 2>&1; then
  1603. -   $1=$2
  1604. -   AC_MSG_RESULT(found)
  1605. +[AC_REQUIRE([AM_MISSING_HAS_RUN])
  1606. +$1=${$1-"${am_missing_run}$2"}
  1607. +AC_SUBST($1)])
  1608. +
  1609. +
  1610. +# AM_MISSING_HAS_RUN
  1611. +# ------------------
  1612. +# Define MISSING if not defined so far and test if it supports --run.
  1613. +# If it does, set am_missing_run to use it, otherwise, to nothing.
  1614. +AC_DEFUN([AM_MISSING_HAS_RUN],
  1615. +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
  1616. +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
  1617. +# Use eval to expand $SHELL
  1618. +if eval "$MISSING --run true"; then
  1619. +  am_missing_run="$MISSING --run "
  1620.  else
  1621. -   $1="$3/missing $2"
  1622. -   AC_MSG_RESULT(missing)
  1623. +  am_missing_run=
  1624. +  AC_MSG_WARN([`missing' script is too old or missing])
  1625.  fi
  1626. -AC_SUBST($1)])
  1627. +])
  1628.  
  1629. -# Like AC_CONFIG_HEADER, but automatically create stamp file.
  1630. +# AM_AUX_DIR_EXPAND
  1631.  
  1632. -AC_DEFUN([AM_CONFIG_HEADER],
  1633. -[AC_PREREQ([2.12])
  1634. -AC_CONFIG_HEADER([$1])
  1635. -dnl When config.status generates a header, we must update the stamp-h file.
  1636. -dnl This file resides in the same directory as the config header
  1637. -dnl that is generated.  We must strip everything past the first ":",
  1638. -dnl and everything past the last "/".
  1639. -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
  1640. -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
  1641. -<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
  1642. -<<am_indx=1
  1643. -for am_file in <<$1>>; do
  1644. -  case " <<$>>CONFIG_HEADERS " in
  1645. -  *" <<$>>am_file "*<<)>>
  1646. -    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
  1647. +# Copyright 2001 Free Software Foundation, Inc.
  1648. +
  1649. +# This program is free software; you can redistribute it and/or modify
  1650. +# it under the terms of the GNU General Public License as published by
  1651. +# the Free Software Foundation; either version 2, or (at your option)
  1652. +# any later version.
  1653. +
  1654. +# This program is distributed in the hope that it will be useful,
  1655. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1656. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1657. +# GNU General Public License for more details.
  1658. +
  1659. +# You should have received a copy of the GNU General Public License
  1660. +# along with this program; if not, write to the Free Software
  1661. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1662. +# 02111-1307, USA.
  1663. +
  1664. +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
  1665. +# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
  1666. +# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
  1667. +#
  1668. +# Of course, Automake must honor this variable whenever it calls a
  1669. +# tool from the auxiliary directory.  The problem is that $srcdir (and
  1670. +# therefore $ac_aux_dir as well) can be either absolute or relative,
  1671. +# depending on how configure is run.  This is pretty annoying, since
  1672. +# it makes $ac_aux_dir quite unusable in subdirectories: in the top
  1673. +# source directory, any form will work fine, but in subdirectories a
  1674. +# relative path needs to be adjusted first.
  1675. +#
  1676. +# $ac_aux_dir/missing
  1677. +#    fails when called from a subdirectory if $ac_aux_dir is relative
  1678. +# $top_srcdir/$ac_aux_dir/missing
  1679. +#    fails if $ac_aux_dir is absolute,
  1680. +#    fails when called from a subdirectory in a VPATH build with
  1681. +#          a relative $ac_aux_dir
  1682. +#
  1683. +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
  1684. +# are both prefixed by $srcdir.  In an in-source build this is usually
  1685. +# harmless because $srcdir is `.', but things will broke when you
  1686. +# start a VPATH build or use an absolute $srcdir.
  1687. +#
  1688. +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
  1689. +# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
  1690. +#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
  1691. +# and then we would define $MISSING as
  1692. +#   MISSING="\${SHELL} $am_aux_dir/missing"
  1693. +# This will work as long as MISSING is not called from configure, because
  1694. +# unfortunately $(top_srcdir) has no meaning in configure.
  1695. +# However there are other variables, like CC, which are often used in
  1696. +# configure, and could therefore not use this "fixed" $ac_aux_dir.
  1697. +#
  1698. +# Another solution, used here, is to always expand $ac_aux_dir to an
  1699. +# absolute PATH.  The drawback is that using absolute paths prevent a
  1700. +# configured tree to be moved without reconfiguration.
  1701. +
  1702. +# Rely on autoconf to set up CDPATH properly.
  1703. +AC_PREREQ([2.50])
  1704. +
  1705. +AC_DEFUN([AM_AUX_DIR_EXPAND], [
  1706. +# expand $ac_aux_dir to an absolute path
  1707. +am_aux_dir=`cd $ac_aux_dir && pwd`
  1708. +])
  1709. +
  1710. +# AM_PROG_INSTALL_SH
  1711. +# ------------------
  1712. +# Define $install_sh.
  1713. +
  1714. +# Copyright 2001 Free Software Foundation, Inc.
  1715. +
  1716. +# This program is free software; you can redistribute it and/or modify
  1717. +# it under the terms of the GNU General Public License as published by
  1718. +# the Free Software Foundation; either version 2, or (at your option)
  1719. +# any later version.
  1720. +
  1721. +# This program is distributed in the hope that it will be useful,
  1722. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1723. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1724. +# GNU General Public License for more details.
  1725. +
  1726. +# You should have received a copy of the GNU General Public License
  1727. +# along with this program; if not, write to the Free Software
  1728. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1729. +# 02111-1307, USA.
  1730. +
  1731. +AC_DEFUN([AM_PROG_INSTALL_SH],
  1732. +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
  1733. +install_sh=${install_sh-"$am_aux_dir/install-sh"}
  1734. +AC_SUBST(install_sh)])
  1735. +
  1736. +# AM_PROG_INSTALL_STRIP
  1737. +
  1738. +# Copyright 2001 Free Software Foundation, Inc.
  1739. +
  1740. +# This program is free software; you can redistribute it and/or modify
  1741. +# it under the terms of the GNU General Public License as published by
  1742. +# the Free Software Foundation; either version 2, or (at your option)
  1743. +# any later version.
  1744. +
  1745. +# This program is distributed in the hope that it will be useful,
  1746. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1747. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1748. +# GNU General Public License for more details.
  1749. +
  1750. +# You should have received a copy of the GNU General Public License
  1751. +# along with this program; if not, write to the Free Software
  1752. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1753. +# 02111-1307, USA.
  1754. +
  1755. +# One issue with vendor `install' (even GNU) is that you can't
  1756. +# specify the program used to strip binaries.  This is especially
  1757. +# annoying in cross-compiling environments, where the build's strip
  1758. +# is unlikely to handle the host's binaries.
  1759. +# Fortunately install-sh will honor a STRIPPROG variable, so we
  1760. +# always use install-sh in `make install-strip', and initialize
  1761. +# STRIPPROG with the value of the STRIP variable (set by the user).
  1762. +AC_DEFUN([AM_PROG_INSTALL_STRIP],
  1763. +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
  1764. +# Installed binaries are usually stripped using `strip' when the user
  1765. +# run `make install-strip'.  However `strip' might not be the right
  1766. +# tool to use in cross-compilation environments, therefore Automake
  1767. +# will honor the `STRIP' environment variable to overrule this program.
  1768. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
  1769. +if test "$cross_compiling" != no; then
  1770. +  AC_CHECK_TOOL([STRIP], [strip], :)
  1771. +fi
  1772. +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
  1773. +AC_SUBST([INSTALL_STRIP_PROGRAM])])
  1774. +
  1775. +# serial 4                        -*- Autoconf -*-
  1776. +
  1777. +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
  1778. +
  1779. +# This program is free software; you can redistribute it and/or modify
  1780. +# it under the terms of the GNU General Public License as published by
  1781. +# the Free Software Foundation; either version 2, or (at your option)
  1782. +# any later version.
  1783. +
  1784. +# This program is distributed in the hope that it will be useful,
  1785. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1786. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1787. +# GNU General Public License for more details.
  1788. +
  1789. +# You should have received a copy of the GNU General Public License
  1790. +# along with this program; if not, write to the Free Software
  1791. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1792. +# 02111-1307, USA.
  1793. +
  1794. +
  1795. +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
  1796. +# written in clear, in which case automake, when reading aclocal.m4,
  1797. +# will think it sees a *use*, and therefore will trigger all it's
  1798. +# C support machinery.  Also note that it means that autoscan, seeing
  1799. +# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
  1800. +
  1801. +
  1802. +
  1803. +# _AM_DEPENDENCIES(NAME)
  1804. +# ----------------------
  1805. +# See how the compiler implements dependency checking.
  1806. +# NAME is "CC", "CXX", "GCJ", or "OBJC".
  1807. +# We try a few techniques and use that to set a single cache variable.
  1808. +#
  1809. +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
  1810. +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
  1811. +# dependency, and given that the user is not expected to run this macro,
  1812. +# just rely on AC_PROG_CC.
  1813. +AC_DEFUN([_AM_DEPENDENCIES],
  1814. +[AC_REQUIRE([AM_SET_DEPDIR])dnl
  1815. +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
  1816. +AC_REQUIRE([AM_MAKE_INCLUDE])dnl
  1817. +AC_REQUIRE([AM_DEP_TRACK])dnl
  1818. +
  1819. +ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
  1820. +       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
  1821. +       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
  1822. +       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
  1823. +                   [depcc="$$1"   am_compiler_list=])
  1824. +
  1825. +AC_CACHE_CHECK([dependency style of $depcc],
  1826. +               [am_cv_$1_dependencies_compiler_type],
  1827. +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
  1828. +  # We make a subdir and do the tests there.  Otherwise we can end up
  1829. +  # making bogus files that we don't know about and never remove.  For
  1830. +  # instance it was reported that on HP-UX the gcc test will end up
  1831. +  # making a dummy file named `D' -- because `-MD' means `put the output
  1832. +  # in D'.
  1833. +  mkdir conftest.dir
  1834. +  # Copy depcomp to subdir because otherwise we won't find it if we're
  1835. +  # using a relative directory.
  1836. +  cp "$am_depcomp" conftest.dir
  1837. +  cd conftest.dir
  1838. +
  1839. +  am_cv_$1_dependencies_compiler_type=none
  1840. +  if test "$am_compiler_list" = ""; then
  1841. +     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
  1842. +  fi
  1843. +  for depmode in $am_compiler_list; do
  1844. +    # We need to recreate these files for each test, as the compiler may
  1845. +    # overwrite some of them when testing with obscure command lines.
  1846. +    # This happens at least with the AIX C compiler.
  1847. +    echo '#include "conftest.h"' > conftest.c
  1848. +    echo 'int i;' > conftest.h
  1849. +    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
  1850. +
  1851. +    case $depmode in
  1852. +    nosideeffect)
  1853. +      # after this tag, mechanisms are not by side-effect, so they'll
  1854. +      # only be used when explicitly requested
  1855. +      if test "x$enable_dependency_tracking" = xyes; then
  1856. +    continue
  1857. +      else
  1858. +    break
  1859. +      fi
  1860.      ;;
  1861. +    none) break ;;
  1862.    esac
  1863. -  am_indx=`expr "<<$>>am_indx" + 1`
  1864. -done<<>>dnl>>)
  1865. -changequote([,]))])
  1866. +    # We check with `-c' and `-o' for the sake of the "dashmstdout"
  1867. +    # mode.  It turns out that the SunPro C++ compiler does not properly
  1868. +    # handle `-M -o', and we need to detect this.
  1869. +    if depmode=$depmode \
  1870. +       source=conftest.c object=conftest.o \
  1871. +       depfile=conftest.Po tmpdepfile=conftest.TPo \
  1872. +       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
  1873. +       grep conftest.h conftest.Po > /dev/null 2>&1 &&
  1874. +       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  1875. +      am_cv_$1_dependencies_compiler_type=$depmode
  1876. +      break
  1877. +    fi
  1878. +  done
  1879. +
  1880. +  cd ..
  1881. +  rm -rf conftest.dir
  1882. +else
  1883. +  am_cv_$1_dependencies_compiler_type=none
  1884. +fi
  1885. +])
  1886. +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
  1887. +])
  1888. +
  1889. +
  1890. +# AM_SET_DEPDIR
  1891. +# -------------
  1892. +# Choose a directory name for dependency files.
  1893. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES
  1894. +AC_DEFUN([AM_SET_DEPDIR],
  1895. +[rm -f .deps 2>/dev/null
  1896. +mkdir .deps 2>/dev/null
  1897. +if test -d .deps; then
  1898. +  DEPDIR=.deps
  1899. +else
  1900. +  # MS-DOS does not allow filenames that begin with a dot.
  1901. +  DEPDIR=_deps
  1902. +fi
  1903. +rmdir .deps 2>/dev/null
  1904. +AC_SUBST([DEPDIR])
  1905. +])
  1906. +
  1907. +
  1908. +# AM_DEP_TRACK
  1909. +# ------------
  1910. +AC_DEFUN([AM_DEP_TRACK],
  1911. +[AC_ARG_ENABLE(dependency-tracking,
  1912. +[  --disable-dependency-tracking Speeds up one-time builds
  1913. +  --enable-dependency-tracking  Do not reject slow dependency extractors])
  1914. +if test "x$enable_dependency_tracking" != xno; then
  1915. +  am_depcomp="$ac_aux_dir/depcomp"
  1916. +  AMDEPBACKSLASH='\'
  1917. +fi
  1918. +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
  1919. +AC_SUBST([AMDEPBACKSLASH])
  1920. +])
  1921. +
  1922. +# Generate code to set up dependency tracking.   -*- Autoconf -*-
  1923. +
  1924. +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
  1925. +
  1926. +# This program is free software; you can redistribute it and/or modify
  1927. +# it under the terms of the GNU General Public License as published by
  1928. +# the Free Software Foundation; either version 2, or (at your option)
  1929. +# any later version.
  1930. +
  1931. +# This program is distributed in the hope that it will be useful,
  1932. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1933. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1934. +# GNU General Public License for more details.
  1935. +
  1936. +# You should have received a copy of the GNU General Public License
  1937. +# along with this program; if not, write to the Free Software
  1938. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1939. +# 02111-1307, USA.
  1940. +
  1941. +#serial 2
  1942. +
  1943. +# _AM_OUTPUT_DEPENDENCY_COMMANDS
  1944. +# ------------------------------
  1945. +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
  1946. +[for mf in $CONFIG_FILES; do
  1947. +  # Strip MF so we end up with the name of the file.
  1948. +  mf=`echo "$mf" | sed -e 's/:.*$//'`
  1949. +  # Check whether this is an Automake generated Makefile or not.
  1950. +  # We used to match only the files named `Makefile.in', but
  1951. +  # some people rename them; so instead we look at the file content.
  1952. +  # Grep'ing the first line is not enough: some people post-process
  1953. +  # each Makefile.in and add a new line on top of each file to say so.
  1954. +  # So let's grep whole file.
  1955. +  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
  1956. +    dirpart=`AS_DIRNAME("$mf")`
  1957. +  else
  1958. +    continue
  1959. +  fi
  1960. +  grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
  1961. +  # Extract the definition of DEP_FILES from the Makefile without
  1962. +  # running `make'.
  1963. +  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
  1964. +  test -z "$DEPDIR" && continue
  1965. +  # When using ansi2knr, U may be empty or an underscore; expand it
  1966. +  U=`sed -n -e '/^U = / s///p' < "$mf"`
  1967. +  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
  1968. +  # We invoke sed twice because it is the simplest approach to
  1969. +  # changing $(DEPDIR) to its actual value in the expansion.
  1970. +  for file in `sed -n -e '
  1971. +    /^DEP_FILES = .*\\\\$/ {
  1972. +      s/^DEP_FILES = //
  1973. +      :loop
  1974. +    s/\\\\$//
  1975. +    p
  1976. +    n
  1977. +    /\\\\$/ b loop
  1978. +      p
  1979. +    }
  1980. +    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
  1981. +       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
  1982. +    # Make sure the directory exists.
  1983. +    test -f "$dirpart/$file" && continue
  1984. +    fdir=`AS_DIRNAME(["$file"])`
  1985. +    AS_MKDIR_P([$dirpart/$fdir])
  1986. +    # echo "creating $dirpart/$file"
  1987. +    echo '# dummy' > "$dirpart/$file"
  1988. +  done
  1989. +done
  1990. +])# _AM_OUTPUT_DEPENDENCY_COMMANDS
  1991. +
  1992. +
  1993. +# AM_OUTPUT_DEPENDENCY_COMMANDS
  1994. +# -----------------------------
  1995. +# This macro should only be invoked once -- use via AC_REQUIRE.
  1996. +#
  1997. +# This code is only required when automatic dependency tracking
  1998. +# is enabled.  FIXME.  This creates each `.P' file that we will
  1999. +# need in order to bootstrap the dependency handling code.
  2000. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
  2001. +[AC_CONFIG_COMMANDS([depfiles],
  2002. +     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
  2003. +     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
  2004. +])
  2005. +
  2006. +# Copyright 2001 Free Software Foundation, Inc.             -*- Autoconf -*-
  2007. +
  2008. +# This program is free software; you can redistribute it and/or modify
  2009. +# it under the terms of the GNU General Public License as published by
  2010. +# the Free Software Foundation; either version 2, or (at your option)
  2011. +# any later version.
  2012. +
  2013. +# This program is distributed in the hope that it will be useful,
  2014. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  2015. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2016. +# GNU General Public License for more details.
  2017. +
  2018. +# You should have received a copy of the GNU General Public License
  2019. +# along with this program; if not, write to the Free Software
  2020. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  2021. +# 02111-1307, USA.
  2022. +
  2023. +# serial 2
  2024. +
  2025. +# AM_MAKE_INCLUDE()
  2026. +# -----------------
  2027. +# Check to see how make treats includes.
  2028. +AC_DEFUN([AM_MAKE_INCLUDE],
  2029. +[am_make=${MAKE-make}
  2030. +cat > confinc << 'END'
  2031. +doit:
  2032. +    @echo done
  2033. +END
  2034. +# If we don't find an include directive, just comment out the code.
  2035. +AC_MSG_CHECKING([for style of include used by $am_make])
  2036. +am__include="#"
  2037. +am__quote=
  2038. +_am_result=none
  2039. +# First try GNU make style include.
  2040. +echo "include confinc" > confmf
  2041. +# We grep out `Entering directory' and `Leaving directory'
  2042. +# messages which can occur if `w' ends up in MAKEFLAGS.
  2043. +# In particular we don't look at `^make:' because GNU make might
  2044. +# be invoked under some other name (usually "gmake"), in which
  2045. +# case it prints its new name instead of `make'.
  2046. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
  2047. +   am__include=include
  2048. +   am__quote=
  2049. +   _am_result=GNU
  2050. +fi
  2051. +# Now try BSD make style include.
  2052. +if test "$am__include" = "#"; then
  2053. +   echo '.include "confinc"' > confmf
  2054. +   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
  2055. +      am__include=.include
  2056. +      am__quote="\""
  2057. +      _am_result=BSD
  2058. +   fi
  2059. +fi
  2060. +AC_SUBST(am__include)
  2061. +AC_SUBST(am__quote)
  2062. +AC_MSG_RESULT($_am_result)
  2063. +rm -f confinc confmf
  2064. +])
  2065. +
  2066. +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
  2067. +
  2068. +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
  2069. +
  2070. +# This program is free software; you can redistribute it and/or modify
  2071. +# it under the terms of the GNU General Public License as published by
  2072. +# the Free Software Foundation; either version 2, or (at your option)
  2073. +# any later version.
  2074. +
  2075. +# This program is distributed in the hope that it will be useful,
  2076. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  2077. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2078. +# GNU General Public License for more details.
  2079. +
  2080. +# You should have received a copy of the GNU General Public License
  2081. +# along with this program; if not, write to the Free Software
  2082. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  2083. +# 02111-1307, USA.
  2084. +
  2085. +AC_PREREQ([2.52])
  2086. +
  2087. +# serial 6
  2088. +
  2089. +# When config.status generates a header, we must update the stamp-h file.
  2090. +# This file resides in the same directory as the config header
  2091. +# that is generated.  We must strip everything past the first ":",
  2092. +# and everything past the last "/".
  2093. +
  2094. +# _AM_DIRNAME(PATH)
  2095. +# -----------------
  2096. +# Like AS_DIRNAME, only do it during macro expansion
  2097. +AC_DEFUN([_AM_DIRNAME],
  2098. +       [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
  2099. +          m4_if(regexp([$1], [^//\([^/]\|$\)]), -1,
  2100. +            m4_if(regexp([$1], [^/.*]), -1,
  2101. +              [.],
  2102. +              patsubst([$1], [^\(/\).*], [\1])),
  2103. +            patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
  2104. +          patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
  2105. +])# _AM_DIRNAME
  2106. +
  2107. +
  2108. +# The stamp files are numbered to have different names.
  2109. +# We could number them on a directory basis, but that's additional
  2110. +# complications, let's have a unique counter.
  2111. +m4_define([_AM_STAMP_Count], [0])
  2112. +
  2113. +
  2114. +# _AM_STAMP(HEADER)
  2115. +# -----------------
  2116. +# The name of the stamp file for HEADER.
  2117. +AC_DEFUN([_AM_STAMP],
  2118. +[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl
  2119. +AS_ESCAPE(_AM_DIRNAME(patsubst([$1],
  2120. +                               [:.*])))/stamp-h[]_AM_STAMP_Count])
  2121. +
  2122. +
  2123. +# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS)
  2124. +# ------------------------------------------------------------
  2125. +# We used to try to get a real timestamp in stamp-h.  But the fear is that
  2126. +# that will cause unnecessary cvs conflicts.
  2127. +AC_DEFUN([_AM_CONFIG_HEADER],
  2128. +[# Add the stamp file to the list of files AC keeps track of,
  2129. +# along with our hook.
  2130. +AC_CONFIG_HEADERS([$1],
  2131. +                  [# update the timestamp
  2132. +echo 'timestamp for $1' >"_AM_STAMP([$1])"
  2133. +$2],
  2134. +                  [$3])
  2135. +])# _AM_CONFIG_HEADER
  2136. +
  2137. +
  2138. +# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS)
  2139. +# --------------------------------------------------------------
  2140. +AC_DEFUN([AM_CONFIG_HEADER],
  2141. +[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])])
  2142. +])# AM_CONFIG_HEADER
  2143.  
  2144.  # Add --enable-maintainer-mode option to configure.
  2145.  # From Jim Meyering
  2146.  
  2147. +# Copyright 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
  2148. +
  2149. +# This program is free software; you can redistribute it and/or modify
  2150. +# it under the terms of the GNU General Public License as published by
  2151. +# the Free Software Foundation; either version 2, or (at your option)
  2152. +# any later version.
  2153. +
  2154. +# This program is distributed in the hope that it will be useful,
  2155. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  2156. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2157. +# GNU General Public License for more details.
  2158. +
  2159. +# You should have received a copy of the GNU General Public License
  2160. +# along with this program; if not, write to the Free Software
  2161. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  2162. +# 02111-1307, USA.
  2163. +
  2164.  # serial 1
  2165.  
  2166.  AC_DEFUN([AM_MAINTAINER_MODE],
  2167. @@ -319,8 +1061,8 @@
  2168.                            (and sometimes confusing) to the casual installer],
  2169.        USE_MAINTAINER_MODE=$enableval,
  2170.        USE_MAINTAINER_MODE=no)
  2171. -  AC_MSG_RESULT($USE_MAINTAINER_MODE)
  2172. -  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
  2173. +  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
  2174. +  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
  2175.    MAINT=$MAINTAINER_MODE_TRUE
  2176.    AC_SUBST(MAINT)dnl
  2177.  ]
  2178. diff -urNEBb binutils-2.14-orig/bfd/amigaos.c binutils-2.14/bfd/amigaos.c
  2179. --- binutils-2.14-orig/bfd/amigaos.c    1970-01-01 01:00:00.000000000 +0100
  2180. +++ binutils-2.14/bfd/amigaos.c    2003-12-02 14:09:39.000000000 +0100
  2181. @@ -0,0 +1,3314 @@
  2182. +/* BFD back-end for Commodore-Amiga AmigaOS binaries.
  2183. +   Copyright (C) 1990-1994 Free Software Foundation, Inc.
  2184. +   Contributed by Leonard Norrgard.  Partially based on the bout
  2185. +   and ieee BFD backends and Markus Wild's tool hunk2gcc.
  2186. +   Revised and updated by Stephan Thesing 
  2187. +
  2188. +This file is part of BFD, the Binary File Descriptor library.
  2189. +
  2190. +This program is free software; you can redistribute it and/or modify
  2191. +it under the terms of the GNU General Public License as published by
  2192. +the Free Software Foundation; either version 2 of the License, or
  2193. +(at your option) any later version.
  2194. +
  2195. +This program is distributed in the hope that it will be useful,
  2196. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  2197. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2198. +GNU General Public License for more details.
  2199. +
  2200. +You should have received a copy of the GNU General Public License
  2201. +along with this program; if not, write to the Free Software
  2202. +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  2203. +
  2204. +/*
  2205. +SECTION
  2206. +    amiga back end
  2207. +
  2208. +This section describes the overall structure of the Amiga BFD back end.
  2209. +The linker stuff can be found in @xref{amigalink}.
  2210. +@menu
  2211. +@* implementation::
  2212. +@* amigalink::
  2213. +@end menu
  2214. +
  2215. +INODE
  2216. +implementation, amigalink, amiga, amiga
  2217. +
  2218. +
  2219. +SECTION
  2220. +    implementation
  2221. +
  2222. +
  2223. +The need for a port of the bfd library for Amiga style object (hunk) files
  2224. +arose by the desire to port the GNU debugger gdb to the Amiga.
  2225. +Also, the linker ld should be updated to the current version (2.5.2).
  2226. +@@*
  2227. +This port bases on the work done by Leonard Norrgard, who started porting
  2228. +gdb. Raphael Luebbert, who supports the ixemul.library, has also worked on
  2229. +implementing the needed @code{ptrace()} system call and gas2.5.
  2230. +
  2231. +@menu
  2232. +@* not supported::
  2233. +@* Does it work ?::
  2234. +@* TODO::
  2235. +@end menu
  2236. +
  2237. +INODE
  2238. +not supported, Does it work ?,implementation,implementation
  2239. +SUBSECTION
  2240. +    not supported
  2241. +
  2242. +Currently, the implementation does not support Amiga link library files, like
  2243. +e.g. amiga.lib. This may be added in a later version, if anyone starts work
  2244. +on it, or I find some time for it.
  2245. +
  2246. +The handling of the symbols in hunk files is a little bit broken:
  2247. +      o The symbols in a load file are totally ignored at the moment, so gdb and gprof
  2248. +            do not work.
  2249. +      o The symbols of a object module (Hunk file, starting with HUNK_UNIT) are read in
  2250. +            correctly, but HUNK_SYMBOL hunks are also ignored.
  2251. +
  2252. +The reason for this is the following:
  2253. +Amiga symbol hunks do not allow for much information. Only a name and a value are allowed.
  2254. +On the other hand, a.out format carries along much more information (see, e.g. the
  2255. +entry on set symbols in the ld manual). The old linker copied this information into
  2256. +a HUNK_DEBUG hunk. Now there is the choice:
  2257. +    o ignoring the debug hunk, read in only HUNK_SYMBOL definitions => extra info is lost.
  2258. +    o read in the debug hunk and use the information therein => How can clashs between the
  2259. +          information in the debug hunk and HUNK_SYMBOL or HUNK_EXT hunks be avoided ?
  2260. +I haven't decided yet, what to do about this.
  2261. +
  2262. +
  2263. +Although bfd allows to link together object modules of different flavours, 
  2264. +producing a.out style executables does not work on Amiga :-)
  2265. +It should, however, be possible to create a.out files with the -r option of ld
  2266. +(incremental link).
  2267. +
  2268. +INODE 
  2269. +Does it work ?,TODO ,not supported , implementation
  2270. +SUBSECTION
  2271. +    Does it work ?
  2272. +
  2273. +Currently, the following utilities work:
  2274. +    o objdump
  2275. +    o objcopy
  2276. +    o strip
  2277. +    o nm
  2278. +    o ar
  2279. +    o gas
  2280. +
  2281. +    
  2282. +INODE
  2283. +TODO, , Does it work ?, implementation
  2284. +SUBSECTION
  2285. +    TODO
  2286. +
  2287. +    o fix fixme:s
  2288. +
  2289. +@*
  2290. +BFD:
  2291. +    o add flag to say if the format allows multiple sections with the
  2292. +          same name.  Fix bfd_get_section_by_name() and bfd_make_section()
  2293. +          accordingly.
  2294. +       
  2295. +    o dumpobj.c: the disassembler: use relocation record data to find symbolic
  2296. +           names of addresses, when available.  Needs new routine where one can
  2297. +          specify the source section of the symbol to be printed as well as some
  2298. +          rewrite of the disassemble functions.
  2299. +       
  2300. +*/
  2301. +
  2302. +#include "bfd.h"
  2303. +#include "bfdlink.h"
  2304. +#include "sysdep.h"
  2305. +#include "genlink.h"
  2306. +#include "libbfd.h"
  2307. +#include "libamiga.h"
  2308. +
  2309. +#ifndef alloca
  2310. +extern PTR alloca ();
  2311. +#endif
  2312. +
  2313. +typedef struct aout_symbol {
  2314. +  asymbol symbol;
  2315. +  short desc;
  2316. +  char other;
  2317. +  unsigned char type;
  2318. +} aout_symbol_type;
  2319. +
  2320. +#include "aout/aout64.h"
  2321. +
  2322. +typedef struct amiga_ardata_struct {
  2323. +  /* generic stuff */
  2324. +  struct artdata generic;
  2325. +  /* amiga-specific stuff */
  2326. +  unsigned long filesize;
  2327. +  struct arch_syms *defsyms;
  2328. +  unsigned long defsym_count;
  2329. +} amiga_ardata_type;
  2330. +
  2331. +#define amiga_ardata(abfd) (*(struct amiga_ardata_struct **)&(abfd)->tdata.aout_ar_data)
  2332. +
  2333. +#define GL(x) bfd_get_32 (abfd, (bfd_byte *) (x))
  2334. +#define GW(x) bfd_get_16 (abfd, (bfd_byte *) (x))
  2335. +#define LONGSIZE(l) (((l)+3) >> 2)
  2336. +
  2337. +#define DEBUG_AMIGA 10000
  2338. +
  2339. +static long determine_datadata_relocs PARAMS ((bfd *, asection *));
  2340. +static bfd_boolean amiga_write_section_contents PARAMS ((bfd *, asection *,
  2341. +                             asection *, long, long*));
  2342. +static bfd_boolean amiga_write_symbols PARAMS ((bfd *, asection *));
  2343. +static bfd_boolean amiga_digest_file PARAMS ((bfd *));
  2344. +static bfd_boolean amiga_mkobject PARAMS ((bfd *));
  2345. +static bfd_boolean amiga_mkarchive PARAMS ((bfd *));
  2346. +static bfd_boolean amiga_read_unit PARAMS ((bfd *, unsigned long));
  2347. +static bfd_boolean amiga_read_load PARAMS ((bfd *));
  2348. +static bfd_boolean amiga_handle_cdb_hunk PARAMS ((bfd *, unsigned long,
  2349. +                         unsigned long, int,
  2350. +                         unsigned long));
  2351. +static bfd_boolean amiga_handle_rest PARAMS ((bfd *,asection *,bfd_boolean));
  2352. +static bfd_boolean write_name PARAMS ((bfd*, const char*, long));
  2353. +
  2354. +/* AmigaOS doesn't like symbols names longer than 124 characters */
  2355. +#define MAX_NAME_SIZE 124
  2356. +
  2357. +extern int amiga_pOS_flg;
  2358. +
  2359. +#if DEBUG_AMIGA
  2360. +#include <stdarg.h>
  2361. +static void
  2362. +error_print(const char *fmt,...)
  2363. +{
  2364. +  va_list args;
  2365. +
  2366. +  va_start (args, fmt);
  2367. +  vfprintf (stderr, fmt, args);
  2368. +  va_end (args);
  2369. +}
  2370. +
  2371. +#define DPRINT(L,x) if (L>=DEBUG_AMIGA) error_print x
  2372. +#else
  2373. +#define DPRINT(L,x) 
  2374. +#endif
  2375. +
  2376. +reloc_howto_type howto_hunk_reloc8 =
  2377. +{
  2378. +  HUNK_RELOC8, /* type */
  2379. +  0,           /* rightshift */
  2380. +  0,           /* size */
  2381. +  8,           /* bitsize */
  2382. +  TRUE,        /* pc_relative */
  2383. +  0,           /* bitpos */
  2384. +  complain_overflow_bitfield,  /* complain_on_overflow */
  2385. +  0,           /* special_function */
  2386. +  "reloc8",    /* textual name */
  2387. +  FALSE,       /* partial_inplace? */
  2388. +  0x000000ff,  /* src_mask */
  2389. +  0x000000ff,  /* dst_mask */
  2390. +  TRUE         /* pcrel_offset */
  2391. +};
  2392. +
  2393. +reloc_howto_type howto_hunk_reloc16 =
  2394. +{HUNK_RELOC16,0,1,16,TRUE,0,complain_overflow_bitfield,0,"reloc16",FALSE,0x0000ffff,0x0000ffff,TRUE};
  2395. +
  2396. +reloc_howto_type howto_hunk_reloc32 =
  2397. +{HUNK_RELOC32,0,2,32,TRUE,0,complain_overflow_bitfield,0,"reloc32",FALSE,0xffffffff,0xffffffff,TRUE};
  2398. +
  2399. +reloc_howto_type howto_hunk_drel8 =
  2400. +{HUNK_DREL8,0,0,8,FALSE,0,complain_overflow_bitfield,0,"drel8",FALSE,0x000000ff,0x000000ff,FALSE};
  2401. +
  2402. +reloc_howto_type howto_hunk_drel16 =
  2403. +{HUNK_DREL16,0,1,16,FALSE,0,complain_overflow_bitfield,0,"drel16",FALSE,0x0000ffff,0x0000ffff,FALSE};
  2404. +
  2405. +reloc_howto_type howto_hunk_drel32 =
  2406. +{HUNK_DREL32,0,2,32,FALSE,0,complain_overflow_bitfield,0,"drel32",FALSE,0xffffffff,0xffffffff,FALSE};
  2407. +
  2408. +reloc_howto_type *amiga_howto_array[2][3] =
  2409. +{
  2410. +  { &howto_hunk_reloc8, &howto_hunk_reloc16, &howto_hunk_reloc32 },
  2411. +  { &howto_hunk_drel8, &howto_hunk_drel16, &howto_hunk_drel32 }
  2412. +};
  2413. +
  2414. +/* The following are gross hacks that need to be fixed.  The problem is
  2415. +   that the linker unconditionally references these values without
  2416. +   going through any of bfd's standard interface.  Thus they need to
  2417. +   be defined in a bfd module that is included in *all* configurations,
  2418. +   and are currently in bfd.c, otherwise linking the linker will fail
  2419. +   on non-Amiga target configurations. */
  2420. +/* This one is used by the linker and tells us, if a debug hunk should be
  2421. +   written out*/
  2422. +extern int write_debug_hunk;
  2423. +/* This is also used by the linker to set the attribute of sections */
  2424. +extern int amiga_attribute;
  2425. +
  2426. +static bfd_boolean
  2427. +get_long (abfd, n)
  2428. +    bfd *abfd;
  2429. +    unsigned long *n;
  2430. +{
  2431. +  if (bfd_bread ((PTR)n, sizeof (*n), abfd) != sizeof (*n))
  2432. +    return FALSE;
  2433. +  *n = GL (n);
  2434. +  return TRUE;
  2435. +}
  2436. +
  2437. +static const struct bfd_target *
  2438. +amiga_object_p (abfd)
  2439. +     bfd *abfd;
  2440. +{
  2441. +  char buf[8];
  2442. +  unsigned int x;
  2443. +  struct stat stat_buffer;
  2444. +
  2445. +  /* An Amiga object file must be at least 8 bytes long.  */
  2446. +  if (bfd_bread ((PTR) buf, 8, abfd) != 8)
  2447. +    {
  2448. +      bfd_set_error(bfd_error_wrong_format);
  2449. +      return 0;
  2450. +    }
  2451. +
  2452. +  bfd_seek (abfd, 0, SEEK_SET);
  2453. +
  2454. +  /* Does it look like an Amiga object file?  */
  2455. +  x = GL(buf);
  2456. +  if ((x != HUNK_UNIT) && (x != HUNK_HEADER) && (x != HUNK_HEADER_POS))
  2457. +    {
  2458. +      /* Not an Amiga file.  */
  2459. +      bfd_set_error(bfd_error_wrong_format);
  2460. +      return 0;
  2461. +    }
  2462. +
  2463. +  /* Can't fail and return (but must be declared boolean to suit
  2464. +     other bfd requirements).  */
  2465. +  (void) amiga_mkobject (abfd);
  2466. +
  2467. +  AMIGA_DATA(abfd)->IsLoadFile = (x == HUNK_HEADER || x == HUNK_HEADER_POS);
  2468. +
  2469. +  if (!amiga_digest_file (abfd))
  2470. +    {
  2471. +      /* Something went wrong.  */
  2472. +      DPRINT (20,("bfd parser stopped at offset 0x%lx\n", bfd_tell (abfd)));
  2473. +      return (const struct bfd_target *) 0;
  2474. +    }
  2475. +
  2476. +  /* Set default architecture to m68k:68000.  */
  2477. +  /* So we can link on 68000 AMIGAs..... */
  2478. +  abfd->arch_info = bfd_scan_arch ("m68k:68000");
  2479. +
  2480. +  return (abfd->xvec);
  2481. +}
  2482. +
  2483. +/* Skip over the hunk length longword + the number of longwords given there.  */
  2484. +#define next_hunk(abfd) \
  2485. +  { AMIGA_DATA(abfd)->file_pointer += 1 + GL(AMIGA_DATA(abfd)->file_pointer); }
  2486. +
  2487. +static asection *
  2488. +amiga_get_section_by_hunk_number (abfd, hunk_number)
  2489. +     bfd *abfd;
  2490. +      long hunk_number;
  2491. +{
  2492. +  /* A cache, so we don't have to search the entire list every time.  */
  2493. +  static asection *last_reference;
  2494. +  static bfd *last_bfd;
  2495. +  asection *p;
  2496. +
  2497. +  switch(hunk_number)
  2498. +    {
  2499. +    case -1:
  2500. +      return bfd_abs_section_ptr;
  2501. +      break;
  2502. +    case -2:
  2503. +      return bfd_und_section_ptr;
  2504. +      break;
  2505. +    case -3: 
  2506. +      return bfd_com_section_ptr;
  2507. +      break;
  2508. +    default:
  2509. +      if (last_reference)
  2510. +    if (last_bfd == abfd && last_reference->target_index == hunk_number)
  2511. +      return last_reference;
  2512. +      for (p = abfd->sections; p != NULL; p = p->next)
  2513. +    if (p->target_index == hunk_number)
  2514. +      {
  2515. +        last_reference = p;
  2516. +        last_bfd = abfd;
  2517. +        return p;
  2518. +      }
  2519. +      BFD_FAIL();
  2520. +      break;
  2521. +    }
  2522. +  return (asection *) 0;
  2523. +}
  2524. +
  2525. +static bfd_boolean
  2526. +amiga_add_reloc (abfd, section, offset, symbol, howto, target_hunk)
  2527. +     bfd *abfd;
  2528. +     asection *section;
  2529. +     bfd_size_type offset;
  2530. +     amiga_symbol_type * symbol;
  2531. +     reloc_howto_type *howto;
  2532. +     long target_hunk;
  2533. +{
  2534. +  amiga_reloc_type *reloc;
  2535. +  static int count;
  2536. +  asection *target_sec;
  2537. +
  2538. +  reloc = (amiga_reloc_type *) bfd_zalloc (abfd, sizeof (amiga_reloc_type));
  2539. +  reloc->next = 0;
  2540. +
  2541. +  if (!reloc)
  2542. +    {
  2543. +      bfd_set_error (bfd_error_no_memory);
  2544. +      return(FALSE);
  2545. +    }
  2546. +
  2547. +  abfd -> flags |= HAS_RELOC;
  2548. +  section -> flags |= SEC_RELOC;
  2549. +
  2550. +  if (amiga_per_section(section)->reloc_tail)
  2551. +    amiga_per_section(section)->reloc_tail->next = reloc;
  2552. +  else
  2553. +    section->relocation = (struct reloc_cache_entry *) reloc;
  2554. +  amiga_per_section(section)->reloc_tail = reloc;
  2555. +  reloc->next = NULL;
  2556. +  reloc->relent.address = offset;
  2557. +  reloc->relent.addend = 0;
  2558. +  reloc->relent.howto = howto;
  2559. +
  2560. +  if (symbol==NULL) {        /* relative to section */
  2561. +    target_sec = amiga_get_section_by_hunk_number (abfd, target_hunk);
  2562. +     if (target_sec)
  2563. +       reloc->symbol = (amiga_symbol_type *)target_sec->symbol;
  2564. +     else
  2565. +       return FALSE;
  2566. +  }
  2567. +  else
  2568. +    reloc->symbol = symbol;
  2569. +  reloc->relent.sym_ptr_ptr=(asymbol **)(&(reloc->symbol));
  2570. +  reloc->target_hunk = target_hunk;
  2571. +
  2572. +  return TRUE;
  2573. +}
  2574. +
  2575. +/* BFD doesn't currently allow multiple sections with the same
  2576. +   name, so we try a little harder to get a unique name.  */
  2577. +asection *
  2578. +amiga_make_unique_section (abfd, name)
  2579. +     bfd *abfd;
  2580. +     CONST char *name;
  2581. +{
  2582. +  asection *section;
  2583. +
  2584. +  bfd_set_error (bfd_error_no_error);
  2585. +  section = bfd_make_section (abfd, name);
  2586. +  if (!section && (bfd_get_error() == bfd_error_no_error))
  2587. +    {
  2588. +#if 0
  2589. +      int i = 1;
  2590. +      char *new_name;
  2591. +
  2592. +      new_name = bfd_alloc (abfd, strlen(name) + 4);
  2593. +
  2594. +      /* We try to come up with an original name (since BFD
  2595. +     currently requires all sections to have different names).  */
  2596. +      while (!section && (i<=99))
  2597. +    {
  2598. +      sprintf (new_name, "%s_%u", name, i++);
  2599. +      section = bfd_make_section (abfd, new_name);
  2600. +    }
  2601. +#else
  2602. +      section = bfd_make_section_anyway (abfd, name);
  2603. +#endif
  2604. +    }
  2605. +  return section;
  2606. +}
  2607. +
  2608. +
  2609. +
  2610. +#if DEBUG_AMIGA
  2611. +#define DPRINTHUNK(x)   fprintf (stderr,"Processing %s hunk (0x%x)...",\
  2612. +      (x) == HUNK_UNIT ? "HUNK_UNIT" :\
  2613. +      (x) == HUNK_NAME ? "HUNK_NAME" :\
  2614. +      (x) == HUNK_DEBUG ? "HUNK_DEBUG" :\
  2615. +      (x) == HUNK_OVERLAY ? "HUNK_OVERLAY" :\
  2616. +      (x) == HUNK_BREAK ? "HUNK_BREAK" :\
  2617. +      (x) == HUNK_HEADER ? "HUNK_HEADER" :\
  2618. +      (x) == HUNK_HEADER_POS ? "HUNK_HEADER_POS" :\
  2619. +      (x) == HUNK_CODE ? "HUNK_CODE" :\
  2620. +      (x) == HUNK_DATA ? "HUNK_DATA" :\
  2621. +      (x) == HUNK_BSS ? "HUNK_BSS" :\
  2622. +      (x) == HUNK_RELOC8 ? "HUNK_RELOC8" :\
  2623. +      (x) == HUNK_RELOC16 ? "HUNK_RELOC16" :\
  2624. +      (x) == HUNK_RELOC32 ? "HUNK_RELOC32" :\
  2625. +      (x) == HUNK_DREL8 ? "HUNK_DREL8" :\
  2626. +      (x) == HUNK_DREL16 ? "HUNK_DREL16" :\
  2627. +      (x) == HUNK_DREL32 ? "HUNK_DREL32" :\
  2628. +      (x) == HUNK_SYMBOL ? "HUNK_SYMBOL" :\
  2629. +      (x) == HUNK_EXT ? "HUNK_EXT" :\
  2630. +      (x) == HUNK_END ? "HUNK_END" :\
  2631. +      (x) == HUNK_LIB ? "HUNK_LIB" :\
  2632. +      (x) == HUNK_INDEX ? "HUNK_INDEX" :\
  2633. +      "*unknown*",(x))
  2634. +#define DPRINTHUNKEND fprintf(stderr,"...done\n")
  2635. +#else
  2636. +#define DPRINTHUNK(x) 
  2637. +#define DPRINTHUNKEND 
  2638. +#endif
  2639. +
  2640. +#define STRSZ_BLOCK 4096
  2641. +#define CARSYM_BLOCK 200
  2642. +
  2643. +static bfd_boolean
  2644. +parse_archive_units (abfd, n_units, filesize, one, syms, symcount)
  2645. +  bfd *abfd;
  2646. +  int *n_units;
  2647. +  unsigned long filesize;
  2648. +  bfd_boolean one;               /* parse only the first unit ? */
  2649. +  struct arch_syms **syms;
  2650. +  symindex *symcount;
  2651. +{
  2652. +  unsigned long hunk_type,pos,no,hunk,len,n;
  2653. +  long section_idx=-1;
  2654. +  symindex defsymcount=0;
  2655. +  unsigned long str_size=0, str_tot_size=0;
  2656. +  char *strings = NULL;
  2657. +  unsigned long unit_offset, defsym_pos=0;
  2658. +  struct arch_syms *nsyms, *syms_tail=NULL;
  2659. +
  2660. +  *n_units = 0;
  2661. +  while (get_long (abfd, &hunk_type)) {
  2662. +    switch (hunk_type) {
  2663. +    case HUNK_UNIT:
  2664. +      unit_offset = bfd_tell (abfd)-4;
  2665. +      (*n_units)++;
  2666. +      if (one && *n_units>1) {
  2667. +    bfd_seek (abfd, -4, SEEK_CUR);
  2668. +    return TRUE;
  2669. +      }
  2670. +      if (get_long (abfd, &len) && !bfd_seek (abfd, len<<2, SEEK_CUR)) {
  2671. +    section_idx = -1;
  2672. +      }
  2673. +      else
  2674. +    return FALSE;
  2675. +      break;
  2676. +    case HUNK_DEBUG:
  2677. +    case HUNK_NAME:
  2678. +      if (!(get_long (abfd, &len) && !bfd_seek (abfd, len<<2, SEEK_CUR)))
  2679. +    return FALSE;
  2680. +      break;
  2681. +    case HUNK_CODE:
  2682. +    case HUNK_DATA:
  2683. +      section_idx++;
  2684. +      if (!(get_long (abfd, &len) && !bfd_seek (abfd, (len&0x3fffffff)<<2,
  2685. +                        SEEK_CUR)))
  2686. +    return FALSE;
  2687. +      break;
  2688. +    case HUNK_BSS:
  2689. +      section_idx++;
  2690. +      if (!get_long (abfd, &len))
  2691. +    return FALSE;
  2692. +      break;
  2693. +    case HUNK_RELOC8:
  2694. +    case HUNK_RELOC16:
  2695. +    case HUNK_RELOC32:
  2696. +      if (!get_long (abfd, &no))
  2697. +    return FALSE;
  2698. +      while (no) {
  2699. +    /* destination hunk */
  2700. +    if (!get_long (abfd, &hunk))
  2701. +      return FALSE;
  2702. +    /* skip the offsets */
  2703. +    if (bfd_seek (abfd, no<<2, SEEK_CUR))
  2704. +      return FALSE;
  2705. +    /* read the number of offsets to come */
  2706. +    if (!get_long (abfd, &no))
  2707. +      return FALSE;
  2708. +      }
  2709. +      break;
  2710. +    case HUNK_END:
  2711. +      break;
  2712. +    case HUNK_DREL8:
  2713. +    case HUNK_DREL16:
  2714. +    case HUNK_DREL32:
  2715. +      fprintf (stderr, "hunk_drelx not supported yet\n");
  2716. +      return FALSE;
  2717. +    case HUNK_SYMBOL:
  2718. +      if (!get_long (abfd, &len))
  2719. +    return FALSE;
  2720. +      while (len) {
  2721. +    if (bfd_seek (abfd, (len+1)<<2, SEEK_CUR))
  2722. +      return FALSE;
  2723. +    if (!get_long (abfd, &len))
  2724. +      return FALSE;
  2725. +      }
  2726. +      break;
  2727. +    case HUNK_EXT:
  2728. +      defsym_pos = 0;
  2729. +      if (!get_long (abfd, &n))
  2730. +    return FALSE;
  2731. +      while (n != 0) {
  2732. +    unsigned long tmp, type;
  2733. +
  2734. +    len = n & 0xffffff;
  2735. +    type = (n>>24) & 0xff;
  2736. +    switch (type) {
  2737. +    case EXT_SYMB:
  2738. +    case EXT_DEF:
  2739. +    case EXT_ABS:
  2740. +      /* retain the positions of defined symbols for each object
  2741. +             in the archive. They'll be used later to build a
  2742. +             pseudo-armap, which _bfd_generic_link_add_archive_symbols
  2743. +             needs */
  2744. +      if (defsym_pos==0)
  2745. +        defsym_pos = bfd_tell (abfd)-4;
  2746. +      /* skip name & value */
  2747. +      if (bfd_seek (abfd, (len+1)<<2, SEEK_CUR))
  2748. +        return FALSE;
  2749. +      defsymcount++;
  2750. +      break;
  2751. +
  2752. +    case EXT_REF8:
  2753. +    case EXT_REF16:
  2754. +    case EXT_REF32:
  2755. +    case EXT_DEXT8:
  2756. +    case EXT_DEXT16:
  2757. +    case EXT_DEXT32:
  2758. +      /* skip name */
  2759. +      if (bfd_seek (abfd, len<<2, SEEK_CUR))
  2760. +        return FALSE;
  2761. +
  2762. +      if (!get_long (abfd, &no))
  2763. +        return FALSE;
  2764. +      if (no)
  2765. +        if (bfd_seek (abfd, no<<2, SEEK_CUR))
  2766. +          return FALSE;
  2767. +      break;
  2768. +
  2769. +    case EXT_COMMON:
  2770. +      /* skip name */
  2771. +      if (bfd_seek (abfd, len<<2, SEEK_CUR))
  2772. +        return FALSE;
  2773. +      /* size of common block */
  2774. +      if (!get_long (abfd, &len))
  2775. +        return FALSE;
  2776. +      /* number of references */
  2777. +      if (!get_long (abfd, &no))
  2778. +        return FALSE;
  2779. +      /* skip references */
  2780. +      if (no)
  2781. +        if (bfd_seek (abfd, no<<2, SEEK_CUR))
  2782. +          return FALSE;
  2783. +      break;
  2784. +
  2785. +    default: /* error */
  2786. +      fprintf (stderr, "unexpected type in hunk_ext at offset 0x%lx\n",
  2787. +           bfd_tell (abfd));
  2788. +      return FALSE;
  2789. +    }
  2790. +
  2791. +    if (!get_long (abfd, &n))
  2792. +      return FALSE;
  2793. +      }
  2794. +      if (defsym_pos != 0 && syms) {
  2795. +    /* there are some defined symbols, keep enough information on
  2796. +           them to simulate an armap later on */
  2797. +    nsyms = (struct arch_syms*) bfd_alloc (abfd, sizeof (struct arch_syms));
  2798. +    nsyms->next = NULL;
  2799. +    if (syms_tail)
  2800. +      syms_tail->next = nsyms;
  2801. +    else
  2802. +      *syms = nsyms;
  2803. +    syms_tail = nsyms;
  2804. +    nsyms->offset = defsym_pos;
  2805. +    nsyms->size = bfd_tell (abfd) - defsym_pos;
  2806. +    nsyms->unit_offset = unit_offset;
  2807. +      }
  2808. +      break; /* of HUNK_EXT */
  2809. +
  2810. +    default:
  2811. +#if 0
  2812. +      fprintf (stderr, "unexpected hunk 0x%lx at offset 0x%lx\n",
  2813. +           hunk_type, bfd_tell (abfd));
  2814. +#endif
  2815. +      return FALSE;
  2816. +    }
  2817. +  }
  2818. +  if (syms && symcount)
  2819. +    *symcount = defsymcount;
  2820. +  return (bfd_tell (abfd) == filesize);
  2821. +}
  2822. +
  2823. +static bfd_boolean
  2824. +amiga_digest_file (abfd)
  2825. +     bfd *abfd;
  2826. +{
  2827. +  amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  2828. +  unsigned long hunk_type,pos;
  2829. +  struct stat stat_buffer;
  2830. +
  2831. +  if (bfd_bread ((PTR) &hunk_type, 4, abfd) != 4)
  2832. +    {
  2833. +      bfd_set_error (bfd_error_wrong_format);
  2834. +      return FALSE;
  2835. +    }
  2836. +
  2837. +  if (bfd_stat (abfd, &stat_buffer) < 0)
  2838. +    return FALSE;
  2839. +
  2840. +  hunk_type = HUNK_VALUE(GL(&hunk_type));
  2841. +
  2842. +  switch (hunk_type)
  2843. +    {
  2844. +    case HUNK_UNIT:
  2845. +      /* Read the unit(s) */
  2846. +/*
  2847. +      while ((pos=bfd_tell (abfd)) < stat_buffer.st_size)
  2848. +    {
  2849. +*/
  2850. +      if (!amiga_read_unit (abfd, stat_buffer.st_size - abfd->origin))
  2851. +    return FALSE;
  2852. +      if (abfd->arelt_data)
  2853. +    arelt_size (abfd) = bfd_tell (abfd);
  2854. +/*    }*/
  2855. +      break;
  2856. +
  2857. +    case HUNK_HEADER:
  2858. +    case HUNK_HEADER_POS:
  2859. +      /* This is a load file */
  2860. +      if (!amiga_read_load (abfd))
  2861. +    return(FALSE);
  2862. +      break;
  2863. +    }
  2864. +
  2865. +  return TRUE;
  2866. +}/* of amiga_digest_file */
  2867. +
  2868. +
  2869. +/* Read in Unit file */
  2870. +/* file pointer is located after the HUNK_UNIT LW */
  2871. +static bfd_boolean
  2872. +amiga_read_unit (abfd, size)
  2873. +    bfd *abfd;
  2874. +    unsigned long size;
  2875. +{
  2876. +  amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  2877. +  unsigned long hunk_type, hunk_number=0;
  2878. +  unsigned long sz;
  2879. +  unsigned long buf[2];
  2880. +
  2881. +  /* read LW length of unit's name */
  2882. +  if (bfd_bread (buf, sizeof (buf[0]), abfd) != sizeof (buf[0]))
  2883. +    return FALSE;
  2884. +
  2885. +  /* and skip it (FIXME maybe) */
  2886. +  if (bfd_seek (abfd, GL(buf)<<2, SEEK_CUR))
  2887. +    return FALSE;
  2888. +
  2889. +  while (bfd_tell (abfd) < size)
  2890. +    {
  2891. +      if (!get_long (abfd, &hunk_type))
  2892. +    return FALSE;
  2893. +
  2894. +      /* Now there may be CODE, DATA, BSS, SYMBOL, DEBUG, RELOC Hunks */
  2895. +      hunk_type = HUNK_VALUE (hunk_type);
  2896. +
  2897. +      switch(hunk_type)
  2898. +    {
  2899. +    case HUNK_UNIT:
  2900. +      /* next unit, seek back and return */
  2901. +      return (bfd_seek (abfd, -4, SEEK_CUR) == 0);
  2902. +
  2903. +    case HUNK_DEBUG:
  2904. +      /* we don't parse hunk_debug at the moment */
  2905. +      if (!get_long (abfd, &sz) || bfd_seek (abfd, sz<<2, SEEK_CUR))
  2906. +        return FALSE;
  2907. +      break;
  2908. +
  2909. +    case HUNK_NAME:
  2910. +    case HUNK_CODE:
  2911. +    case HUNK_DATA:
  2912. +    case HUNK_BSS:
  2913. +      /* Handle this hunk, including relocs, etc.
  2914. +         The finishing HUNK_END is consumed by the routine
  2915. +         */
  2916. +      if (!amiga_handle_cdb_hunk (abfd, hunk_type, hunk_number++,
  2917. +                      0, -1))
  2918. +        return FALSE;
  2919. +
  2920. +      break;
  2921. +
  2922. +    default:
  2923. +      /* Something very nasty happened:
  2924. +         Illegal Hunk occured....
  2925. +         */
  2926. +      bfd_set_error (bfd_error_wrong_format);
  2927. +      return FALSE;
  2928. +      break;
  2929. +    }/* Of switch hunk_type */
  2930. +
  2931. +      /* Next hunk */
  2932. +    }
  2933. +  return TRUE;
  2934. +}
  2935. +
  2936. +
  2937. +/* Read a load file */
  2938. +static bfd_boolean
  2939. +amiga_read_load (abfd)
  2940. +    bfd *abfd;
  2941. +{
  2942. +  amiga_data_type *amiga_data = AMIGA_DATA(abfd); 
  2943. +  unsigned long *hunk_attributes, *hunk_sizes;
  2944. +  int hunk_number=0;
  2945. +  int hunk_type;
  2946. +  unsigned long max_hunk_number;
  2947. +  int i,n;
  2948. +  unsigned long buf[4];
  2949. +
  2950. +  /* Read hunk lengths (and memory attributes...) */
  2951. +  /* Read in each hunk */
  2952. +
  2953. +  if (bfd_bread (buf, sizeof(*buf) * 4, abfd) != 4 * sizeof (*buf))
  2954. +    return FALSE;
  2955. +
  2956. +  /* If there are resident libs: abort (obsolete feature) */
  2957. +  if (GL(buf) != 0)
  2958. +    return FALSE;
  2959. +
  2960. +  max_hunk_number = GL(buf+1);
  2961. +
  2962. +  /* Sanity */
  2963. +  if (max_hunk_number<1)
  2964. +    {
  2965. +      bfd_set_error (bfd_error_wrong_format);
  2966. +      return FALSE;
  2967. +    }
  2968. +
  2969. +  amiga_data->nb_hunks = max_hunk_number;
  2970. +
  2971. +  /* Num of root hunk must be 0 */
  2972. +  if (GL(buf+2)!=0)
  2973. +    {
  2974. +      bfd_set_error (bfd_error_wrong_format);
  2975. +      return FALSE;
  2976. +    }
  2977. +
  2978. +  /* Num of last hunk must be mhn-1 */
  2979. +  if (GL(buf+3) != max_hunk_number-1)
  2980. +    {
  2981. +      fprintf (stderr, "Overlay loadfiles are not supported\n");
  2982. +      bfd_set_error (bfd_error_wrong_format);
  2983. +      return FALSE;
  2984. +    }
  2985. +
  2986. +  hunk_sizes = alloca (max_hunk_number * sizeof (unsigned long));
  2987. +  hunk_attributes = alloca (max_hunk_number * sizeof (unsigned long));
  2988. +
  2989. +  if (hunk_sizes == NULL || hunk_attributes == NULL)
  2990. +    {
  2991. +      bfd_set_error (bfd_error_no_memory);
  2992. +      return FALSE;
  2993. +    }
  2994. +
  2995. +  if (bfd_bread (hunk_sizes, sizeof (unsigned long) * max_hunk_number, abfd) !=
  2996. +      max_hunk_number * sizeof (unsigned long))
  2997. +    return FALSE;
  2998. +
  2999. +  /* Now, read in sizes and memory attributes */
  3000. +  for (i=0; i<max_hunk_number; i++)
  3001. +    {
  3002. +      /* convert to host format */
  3003. +      hunk_sizes[i] = GL(hunk_sizes+i);
  3004. +      switch (HUNK_ATTRIBUTE (hunk_sizes[i]))
  3005. +    {
  3006. +    case HUNK_ATTR_CHIP:
  3007. +      hunk_attributes[i] = MEMF_CHIP;
  3008. +      break;
  3009. +    case HUNK_ATTR_FAST:
  3010. +      hunk_attributes[i] = MEMF_FAST;
  3011. +      break;
  3012. +    case HUNK_ATTR_FOLLOWS:
  3013. +      if (!get_long (abfd, &hunk_attributes[i]))
  3014. +        return FALSE;
  3015. +      break;
  3016. +    default:
  3017. +      hunk_attributes[i] = 0;
  3018. +      break;
  3019. +    }
  3020. +      hunk_sizes[i] = (HUNK_VALUE (hunk_sizes[i]))<<2;
  3021. +    }
  3022. +
  3023. +  for (hunk_number=0; hunk_number < max_hunk_number; hunk_number++)
  3024. +    {
  3025. +      if (bfd_bread (buf, sizeof(*buf), abfd) != sizeof(*buf))
  3026. +    return FALSE;
  3027. +      hunk_type = HUNK_VALUE (GL(buf));
  3028. +
  3029. +      /* This may be HUNK_NAME, CODE, BSS, DEBUG, DATA */
  3030. +      switch(hunk_type)
  3031. +    {
  3032. +    case HUNK_NAME:
  3033. +    case HUNK_CODE:
  3034. +    case HUNK_DATA:
  3035. +    case HUNK_BSS:
  3036. +    case HUNK_DEBUG:
  3037. +      if (!amiga_handle_cdb_hunk (abfd, hunk_type, hunk_number,
  3038. +                      hunk_attributes[hunk_number],
  3039. +                      hunk_sizes[hunk_number]))
  3040. +        {
  3041. +          bfd_set_error (bfd_error_wrong_format);
  3042. +          return FALSE;
  3043. +        }
  3044. +      break;
  3045. +
  3046. +    default:
  3047. +      /* illegal hunk */
  3048. +      bfd_set_error (bfd_error_wrong_format);
  3049. +      return FALSE;
  3050. +      break;
  3051. +    }/* Of switch */
  3052. +    }
  3053. +
  3054. +  return TRUE;
  3055. +}/* Of amiga_read_load */
  3056. +
  3057. +
  3058. +/* Handle NAME, CODE, DATA, BSS, DEBUG Hunks */
  3059. +static bfd_boolean 
  3060. +amiga_handle_cdb_hunk (abfd, hunk_type, hunk_number, hunk_attribute,
  3061. +               hunk_size)
  3062. +     bfd *abfd;
  3063. +     unsigned long hunk_type;
  3064. +     unsigned long hunk_number;
  3065. +     int hunk_attribute;
  3066. +     unsigned long hunk_size;
  3067. +/* If hunk_size==-1, then we are digesting a HUNK_UNIT */
  3068. +{
  3069. +  amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  3070. +  char *current_name=NULL;
  3071. +  unsigned long len;
  3072. +  asection *current_section=NULL;
  3073. +  int is_load = (hunk_size!=-1);
  3074. +  unsigned long buf[6];
  3075. +  int secflags;
  3076. +
  3077. +  if (hunk_type==HUNK_NAME) /* get name */
  3078. +    {
  3079. +      if (!get_long (abfd, &len))
  3080. +    return FALSE;
  3081. +      len = (HUNK_VALUE (len)) << 2;
  3082. +      current_name = bfd_alloc (abfd, len+1);
  3083. +      if (!current_name)
  3084. +    return FALSE;
  3085. +
  3086. +      if (bfd_bread (current_name, len, abfd) != len)
  3087. +    return FALSE;
  3088. +
  3089. +      current_name [len] = '\0';
  3090. +
  3091. +      if (!get_long (abfd, &hunk_type))
  3092. +    return FALSE;
  3093. +
  3094. +    }
  3095. +  else /* Set curent name to something appropriate */
  3096. +    current_name=(hunk_type==HUNK_CODE)?".text":
  3097. +                 (hunk_type==HUNK_BSS)?".bss":".data";
  3098. +
  3099. +  /* file_pointer is now after hunk_type */
  3100. +  secflags = 0;
  3101. +  switch (hunk_type)
  3102. +    {
  3103. +    case HUNK_CODE:
  3104. +      secflags = SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS;
  3105. +      goto do_section;
  3106. +
  3107. +    case HUNK_DATA:
  3108. +      secflags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
  3109. +      goto do_section;
  3110. +
  3111. +    case HUNK_BSS:
  3112. +      secflags = SEC_ALLOC;
  3113. +
  3114. +    do_section:
  3115. +      if (!get_long (abfd, &len))
  3116. +    return FALSE;
  3117. +      len = HUNK_VALUE (len)<<2; /* Length of section */
  3118. +      if (!is_load)
  3119. +    {
  3120. +      hunk_attribute = HUNK_ATTRIBUTE (len);
  3121. +      hunk_attribute=(hunk_attribute==HUNK_ATTR_CHIP)?MEMF_CHIP:
  3122. +                 (hunk_attribute==HUNK_ATTR_FAST)?MEMF_FAST:0;
  3123. +    }
  3124. +
  3125. +      /* Make new section */
  3126. +      current_section = amiga_make_unique_section (abfd, current_name);
  3127. +      if (!current_section)
  3128. +    return FALSE;
  3129. +
  3130. +      current_section->filepos = bfd_tell (abfd);
  3131. +      /* For a loadfile, the section size in memory comes from the
  3132. +         hunk header. The size on disk may be smaller. */
  3133. +      current_section->_cooked_size = current_section->_raw_size =
  3134. +    ((hunk_size==-1) ? len : hunk_size);
  3135. +      current_section->target_index = hunk_number;
  3136. +      bfd_set_section_flags (abfd, current_section, secflags);
  3137. +
  3138. +      amiga_per_section(current_section)->disk_size = len; /* size on disk */
  3139. +      amiga_per_section(current_section)->attribute = hunk_attribute;
  3140. +
  3141. +      /* skip the contents */
  3142. +      if ((secflags & SEC_HAS_CONTENTS) && bfd_seek (abfd, len, SEEK_CUR))
  3143. +    return FALSE;
  3144. +
  3145. +      if (!amiga_handle_rest (abfd, current_section, is_load))
  3146. +    return FALSE;
  3147. +      break;
  3148. +
  3149. +      /* Currently, there is one debug hunk per executable, instead of
  3150. +         one per unit as it would with a "standard" amigaos
  3151. +         implementation. So the debug hunk is at the same level as
  3152. +         code/data/bss. This will change in the future */
  3153. +    case HUNK_DEBUG:
  3154. +      /* format of gnu debug hunk is:
  3155. +          HUNK_DEBUG
  3156. +              N
  3157. +            0413.L    Magic number
  3158. +      symtabsize
  3159. +      strtabsize
  3160. +      symtabdata  [length=symtabsize]
  3161. +      strtabdata  [length=strtabsize]
  3162. +          [pad bytes]
  3163. +      */
  3164. +
  3165. +      /* read LW length */
  3166. +      if (bfd_bread (buf, sizeof(*buf), abfd) != sizeof (*buf))
  3167. +    return FALSE;
  3168. +
  3169. +      len = GL (buf) << 2;
  3170. +      if (len > 5*sizeof(long))
  3171. +    {
  3172. +      if (bfd_bread (buf, sizeof(*buf) * 6, abfd) != 6*sizeof(*buf))
  3173. +        return FALSE;
  3174. +
  3175. +      if (GL(buf) == 0413) /* GNU DEBUG HUNK */
  3176. +        {
  3177. +          /*FIXME: we should add the symbols in the debug hunk to symtab... */
  3178. +          amiga_data->symtab_size = GL(buf+1);
  3179. +          amiga_data->stringtab_size = GL(buf+2);
  3180. +          adata(abfd).sym_filepos = bfd_tell (abfd);
  3181. +          adata(abfd).str_filepos = adata(abfd).sym_filepos +
  3182. +        amiga_data->symtab_size;
  3183. +          len -= 5*sizeof(long);
  3184. +        }
  3185. +    }
  3186. +      if (bfd_seek (abfd, len, SEEK_CUR))
  3187. +    return FALSE;
  3188. +      break;
  3189. +
  3190. +    default:
  3191. +      bfd_set_error (bfd_error_wrong_format);
  3192. +      return FALSE;
  3193. +      break;
  3194. +    } /* switch (hunk_type) */
  3195. +
  3196. +  return TRUE;
  3197. +
  3198. +} /* Of amiga_handle_cdb_hunk */
  3199. +
  3200. +
  3201. +/* Handle rest of a hunk 
  3202. +   I.e.: Relocs, EXT, SYMBOLS... */
  3203. +static bfd_boolean
  3204. +amiga_handle_rest (abfd, current_section, isload)
  3205. +     bfd *abfd;
  3206. +     asection *current_section;
  3207. +     bfd_boolean isload;
  3208. +{
  3209. +  amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  3210. +  unsigned long hunk_type, type, len, n;
  3211. +  long tmp;
  3212. +  unsigned long **p, no, *countptr;
  3213. +  struct amiga_raw_symbol *sp=NULL;
  3214. +  unsigned long buf[5];
  3215. +  file_ptr filepos;
  3216. +  amiga_per_section_type *asect = amiga_per_section (current_section);
  3217. +
  3218. +  while (1)
  3219. +    {
  3220. +      if (!get_long (abfd, &hunk_type))
  3221. +    return FALSE;
  3222. +      switch (hunk_type)
  3223. +    {
  3224. +    case HUNK_END:
  3225. +      return TRUE;
  3226. +      break;
  3227. +
  3228. +    case HUNK_RELOC8:
  3229. +      asect->raw_relocs8 = bfd_tell (abfd)-4;
  3230. +      countptr = &asect->num_raw_relocs8;
  3231. +      goto rel;
  3232. +    case HUNK_RELOC16:
  3233. +      asect->raw_relocs16 = bfd_tell (abfd)-4;
  3234. +      countptr = &asect->num_raw_relocs16;
  3235. +      goto rel;
  3236. +    case HUNK_RELOC32:
  3237. +      asect->raw_relocs32 = bfd_tell (abfd)-4;
  3238. +      countptr = &asect->num_raw_relocs32;
  3239. +      goto rel;
  3240. +    case HUNK_DREL8:
  3241. +      fprintf (stderr, "hunk_drel8 not supported yet\n");
  3242. +      return FALSE;
  3243. +    case HUNK_DREL16:
  3244. +      fprintf (stderr, "hunk_drel16 not supported yet\n");
  3245. +      return FALSE;
  3246. +    case HUNK_DREL32:
  3247. +      fprintf (stderr, "hunk_drel32 not supported yet\n");
  3248. +      return FALSE;
  3249. +    rel:
  3250. +      current_section->flags |= SEC_RELOC;
  3251. +      abfd->flags |= HAS_RELOC;
  3252. +
  3253. +      /* read the first number of relocs */
  3254. +      if (!get_long (abfd, &no))
  3255. +        return FALSE;
  3256. +
  3257. +      /* count and skip them */
  3258. +      while (no != 0)
  3259. +        {
  3260. +          current_section->reloc_count += no;
  3261. +          (*countptr) += no;
  3262. +          if (bfd_seek (abfd, (no+1)<<2, SEEK_CUR))
  3263. +        return FALSE;
  3264. +          if (!get_long (abfd, &no))
  3265. +        return FALSE;
  3266. +        }
  3267. +      break;
  3268. +
  3269. +    case HUNK_SYMBOL:
  3270. +      /* In a unit, we ignore these, since all symbol information
  3271. +         comes with HUNK_EXT, in a load file, these are added */
  3272. +      if (!isload)
  3273. +        {
  3274. +          amiga_per_section(current_section)->hunk_symbol_pos =
  3275. +        bfd_tell (abfd);
  3276. +          /* size of first symbol */
  3277. +          if (bfd_bread (buf, sizeof(*buf), abfd) != sizeof (*buf))
  3278. +        return FALSE;
  3279. +          while (GL(buf) != 0) /* until size is 0 */
  3280. +        {
  3281. +          /* skip the name */
  3282. +          if (bfd_seek (abfd, (GL(buf)+1)<<2, SEEK_CUR))
  3283. +            return FALSE;
  3284. +          /* read the size */
  3285. +          if (bfd_bread (buf, sizeof(*buf), abfd) != sizeof (*buf))
  3286. +            return FALSE;
  3287. +        }
  3288. +          break;
  3289. +        }
  3290. +      /* We add these, by falling through... */
  3291. +
  3292. +    case HUNK_EXT:
  3293. +      /* We leave these alone, until they are requested by the user */
  3294. +      amiga_per_section(current_section)->hunk_ext_pos = bfd_tell (abfd);
  3295. +
  3296. +      if (!get_long (abfd, &n))
  3297. +        return FALSE;
  3298. +      while (n != 0)
  3299. +        {
  3300. +          /* read the symbol type and length */
  3301. +          type = (n>>24) & 0xff;
  3302. +          len = n & 0xffffff;
  3303. +
  3304. +          /* skip the symbol name */
  3305. +          if (bfd_seek (abfd, len<<2, SEEK_CUR))
  3306. +        return FALSE;
  3307. +
  3308. +          switch(type)
  3309. +        {
  3310. +        case EXT_SYMB: /* Symbol hunks are relative to hunk start... */
  3311. +        case EXT_DEF: /* def relative to hunk */
  3312. +        case EXT_ABS: /* def absolute */
  3313. +          abfd->flags |= HAS_SYMS; /* We have symbols */
  3314. +          abfd->symcount++;
  3315. +          /* skip the value */
  3316. +          if (!get_long (abfd, &tmp))
  3317. +            return FALSE;
  3318. +          break;
  3319. +
  3320. +        case EXT_REF8: /* 8 bit ref */
  3321. +        case EXT_REF16: /* 16 bit ref */
  3322. +        case EXT_REF32: /* 32 bit ref */
  3323. +        case EXT_DEXT8: /* 8 bit base relative ref */
  3324. +        case EXT_DEXT16: /* 16 bit " "*/
  3325. +        case EXT_DEXT32: /* 32 bit " " */
  3326. +          abfd->flags |= HAS_SYMS;
  3327. +          abfd->symcount++;
  3328. +          if (!get_long (abfd, &tmp))
  3329. +            return FALSE;
  3330. +          if (tmp)
  3331. +            {
  3332. +              abfd->flags|=HAS_RELOC;
  3333. +              current_section->flags|=SEC_RELOC;
  3334. +              current_section->reloc_count += tmp;
  3335. +              /* skip references */
  3336. +              if (bfd_seek (abfd, tmp<<2, SEEK_CUR))
  3337. +            return FALSE;
  3338. +            }
  3339. +          break;
  3340. +
  3341. +        case EXT_COMMON: /* Common ref/def */
  3342. +          abfd->flags |= HAS_SYMS;
  3343. +          abfd->symcount++;
  3344. +          /* skip the size of common block: FIXME */
  3345. +          if (!get_long (abfd, &tmp))
  3346. +            return FALSE;
  3347. +          if (!get_long (abfd, &tmp))
  3348. +            return FALSE;
  3349. +          if (tmp)
  3350. +            {
  3351. +              abfd->flags |= HAS_RELOC;
  3352. +              current_section->flags |= SEC_RELOC;
  3353. +              current_section->reloc_count += tmp;
  3354. +              if (bfd_seek (abfd, tmp<<2, SEEK_CUR))
  3355. +            return FALSE;
  3356. +            }
  3357. +          break;
  3358. +
  3359. +        default: /* error */
  3360. +          bfd_set_error (bfd_error_wrong_format);
  3361. +          return FALSE;
  3362. +          break;
  3363. +        }/* of switch type */
  3364. +
  3365. +          if (!get_long (abfd, &n))
  3366. +        return FALSE;
  3367. +        }
  3368. +      break;
  3369. +
  3370. +      /* If a debug hunk is found at this position, the file has
  3371. +             been generated by a third party tool and the debug info
  3372. +             here are useless to us. Just skip the hunk, then. */
  3373. +    case HUNK_DEBUG:
  3374. +      if (!get_long (abfd, &n) || bfd_seek (abfd, n<<2, SEEK_CUR))
  3375. +        return FALSE;
  3376. +      break;
  3377. +    default: /* error */
  3378. +      bfd_set_error (bfd_error_wrong_format);
  3379. +      return FALSE;
  3380. +      break;
  3381. +    }/* Of switch */
  3382. +    }/* of while */
  3383. +  return TRUE;
  3384. +}/* of amiga_handle_rest*/
  3385. +
  3386. +static bfd_boolean
  3387. +amiga_mkobject (abfd)
  3388. +     bfd *abfd;
  3389. +{
  3390. +  struct amiga_data_struct *rawptr;
  3391. +
  3392. +  rawptr = (struct amiga_data_struct *)
  3393. +    bfd_zalloc (abfd, sizeof (struct amiga_data_struct));
  3394. +  abfd->tdata.amiga_data = rawptr;
  3395. +  return rawptr != NULL;
  3396. +}
  3397. +
  3398. +static bfd_boolean
  3399. +amiga_mkarchive (abfd)
  3400. +     bfd *abfd;
  3401. +{
  3402. +  amiga_ardata_type *ar;
  3403. +  ar = (amiga_ardata_type*) bfd_zalloc (abfd, sizeof (amiga_ardata_type));
  3404. +  amiga_ardata (abfd) = ar;
  3405. +  return (ar!=NULL);
  3406. +}
  3407. +
  3408. +/* used with base relative linking */
  3409. +extern int amiga_base_relative;
  3410. +
  3411. +/* used with -resident linking */
  3412. +extern int amiga_resident;
  3413. +
  3414. +/* write nb long words (possibly swapped out) to the output file */
  3415. +static bfd_boolean
  3416. +write_longs (in, nb, abfd)
  3417. +     unsigned long *in;
  3418. +     long nb;
  3419. +     bfd *abfd;
  3420. +{
  3421. +  unsigned long out [10];
  3422. +  int i;
  3423. +  
  3424. +  while (nb > 0)
  3425. +    {
  3426. +      for (i=0; i<nb && i<10; i++)
  3427. +    out[i] = GL (in++);
  3428. +      if (bfd_bwrite ((PTR)out, sizeof (long) * i, abfd) != sizeof(long)*i)
  3429. +    return FALSE;
  3430. +      nb -= 10;
  3431. +    }
  3432. +  return TRUE;
  3433. +}
  3434. +
  3435. +static long
  3436. +determine_datadata_relocs (abfd, section)
  3437. +     bfd *abfd;
  3438. +     asection *section;
  3439. +{
  3440. +  long relocs = 1, i;
  3441. +  struct reloc_cache_entry *r;
  3442. +  asection *insection;
  3443. +  asymbol *sym_p;
  3444. +  
  3445. +  for (i=0;i<section->reloc_count;i++)
  3446. +    {
  3447. +      r=section->orelocation[i];
  3448. +      if (r == NULL)
  3449. +        continue;
  3450. +      sym_p=*(r->sym_ptr_ptr); /* The symbol for this section */
  3451. +      insection=sym_p->section;
  3452. +
  3453. +      /* Is reloc relative to a special section ? */
  3454. +      if ((insection==bfd_abs_section_ptr)||(insection==bfd_com_section_ptr)||
  3455. +      (insection==bfd_und_section_ptr)||(insection==bfd_ind_section_ptr))
  3456. +    continue; /* Nothing to do, since this translates to HUNK_EXT */
  3457. +      if (insection->output_section == section)
  3458. +        relocs++;
  3459. +    }
  3460. +  return relocs;
  3461. +}
  3462. +
  3463. +/* Adjust the indices map when we decide not to output the section <sec> */
  3464. +static void
  3465. +remove_section_index (sec, index_map)
  3466. +    asection *sec;
  3467. +    long *index_map;
  3468. +{
  3469. +  int i = sec->index;
  3470. +  sec = sec->next;
  3471. +  index_map[i++] = -1;
  3472. +  while (sec!=NULL) {
  3473. +    (index_map[i++])--;
  3474. +    sec=sec->next;
  3475. +  }
  3476. +}
  3477. +
  3478. +/* Write out the contents of a bfd */
  3479. +static bfd_boolean
  3480. +amiga_write_object_contents (abfd)
  3481. +     bfd *abfd;
  3482. +{
  3483. +  struct amiga_data_struct *amiga_data=AMIGA_DATA(abfd);
  3484. +  sec_ptr p;
  3485. +  unsigned long n[5];
  3486. +  long i;
  3487. +  static const char zero[3]={0,0,0};
  3488. +  long datadata_relocs, bss_size = 0;
  3489. +  long *index_map;
  3490. +  asection *data_sec;
  3491. +
  3492. +  /* Distinguish UNITS, LOAD Files
  3493. +    Write out hunks+relocs+HUNK_EXT+HUNK_DEBUG (GNU format)*/
  3494. +  DPRINT(5,("Entering write_object_conts\n"));
  3495. +
  3496. +  abfd->output_has_begun=TRUE; /* Output has begun */
  3497. +
  3498. +  index_map = bfd_alloc (abfd, abfd->section_count * sizeof (long));
  3499. +  if (!index_map)
  3500. +    return FALSE;
  3501. +
  3502. +  for (i=0, p=abfd->sections; p!=NULL; p=p->next)
  3503. +    index_map[i++] = p->index;
  3504. +
  3505. +  /* Distinguish Load files and Unit files */
  3506. +  if (amiga_data->IsLoadFile)
  3507. +    {
  3508. +      DPRINT(5,("Writing Load file\n"));
  3509. +
  3510. +      /* Write out load file header */
  3511. +      if (amiga_pOS_flg)
  3512. +    n[0] = HUNK_HEADER_POS;
  3513. +      else
  3514. +    n[0] = HUNK_HEADER;
  3515. +      n[1] = n[2] = 0;
  3516. +      for (p=abfd->sections; p!=NULL; p=p->next) {
  3517. +    /* For baserel linking, don't remove the empty sections, since
  3518. +           they may get some contents later on */
  3519. +    if ((amiga_base_relative || p->_raw_size!=0 || p->_cooked_size!=0) &&
  3520. +        !(amiga_base_relative && !strcmp (p->name, ".bss")))
  3521. +      n[2]++;
  3522. +    else
  3523. +      remove_section_index (p, index_map);
  3524. +      }
  3525. +
  3526. +      if (amiga_base_relative)
  3527. +    BFD_ASSERT(abfd->section_count==3);
  3528. +
  3529. +      n[3]=0;
  3530. +      n[4]=n[2]-1;
  3531. +      if (!write_longs (n, 5, abfd))
  3532. +    return FALSE;
  3533. +
  3534. +      /* Write out sizes and memory specifiers... */
  3535. +      /* We have to traverse the section list again, bad but no other way... */
  3536. +      if (amiga_base_relative) {
  3537. +        for (p=abfd->sections; p!=NULL; p=p->next)
  3538. +      {
  3539. +        if (amiga_resident && strcmp(p->name,".data")==0)
  3540. +          {
  3541. +            datadata_relocs = determine_datadata_relocs (abfd, p);
  3542. +            data_sec = p;
  3543. +          }
  3544. +        else if (strcmp(p->name,".bss")==0)
  3545. +          {
  3546. +            /* Get size for header*/
  3547. +              bss_size = p->_raw_size;
  3548. +          }
  3549. +      }
  3550. +      }
  3551. +
  3552. +      for (p=abfd->sections; p!=NULL; p=p->next)
  3553. +    {
  3554. +          long extra = 0;
  3555. +
  3556. +      if (index_map[p->index] < 0)
  3557. +        continue;
  3558. +      if (amiga_resident && (strcmp(p->name,".text")==0))
  3559. +        extra = datadata_relocs*4;
  3560. +      else {
  3561. +        if (amiga_base_relative && !strcmp (p->name, ".data"))
  3562. +          extra = bss_size;
  3563. +      }
  3564. +
  3565. +      if (amiga_per_section(p)->disk_size == 0)
  3566. +        amiga_per_section(p)->disk_size = p->_raw_size;
  3567. +
  3568. +      /* convert to a size in long words */
  3569. +      n[0] = LONGSIZE (p->_raw_size+extra);
  3570. +
  3571. +      i=amiga_per_section(p)->attribute;
  3572. +      switch (i)
  3573. +        {
  3574. +        case MEMF_CHIP:
  3575. +          n[0]|=0x40000000;
  3576. +          i=1;
  3577. +          break;
  3578. +        case MEMF_FAST:
  3579. +          n[0]|=0x80000000;
  3580. +          i=1;
  3581. +          break;
  3582. +        case 0: /* nothing*/
  3583. +          i=1;
  3584. +          break;
  3585. +        default: /* Special one */
  3586. +          n[0]|=0xc0000000;
  3587. +          n[1]=i;
  3588. +          i=2;
  3589. +          break;
  3590. +        }/* Of switch */
  3591. +
  3592. +      if (!write_longs (n, i, abfd))
  3593. +            return FALSE;
  3594. +    }/* Of for */
  3595. +    }
  3596. +  else
  3597. +    {/* Unit , no base-relative linking here.... */
  3598. +      int len = strlen (abfd->filename);
  3599. +      /* Write out unit header */
  3600. +      DPRINT(5,("Writing Unit\n"));
  3601. +
  3602. +      n[0]=HUNK_UNIT;
  3603. +      if (!write_longs (n, 1, abfd))
  3604. +    return FALSE;
  3605. +
  3606. +      i = LONGSIZE (len);
  3607. +      if (!write_name (abfd, abfd->filename, 0))
  3608. +    return FALSE;
  3609. +    }
  3610. +
  3611. +  /* Write out every section */
  3612. +  for (p=abfd->sections; p!=NULL; p=p->next)
  3613. +    {
  3614. +      if (index_map[p->index] < 0)
  3615. +    continue;
  3616. +      if (amiga_per_section(p)->disk_size == 0)
  3617. +    amiga_per_section(p)->disk_size = p->_raw_size;
  3618. +
  3619. +      if (amiga_resident && (strcmp(p->name,".text")==0))
  3620. +        {
  3621. +          if (!amiga_write_section_contents (abfd,p,data_sec,datadata_relocs,
  3622. +                        index_map))
  3623. +        return FALSE;
  3624. +        }
  3625. +      else if (amiga_base_relative && (strcmp(p->name,".data")==0))
  3626. +        {
  3627. +          if (!amiga_write_section_contents (abfd,p,0,0,index_map))
  3628. +        return FALSE;
  3629. +        }
  3630. +      else
  3631. +        { 
  3632. +          if (!amiga_write_section_contents (abfd,p,0,0,index_map))
  3633. +        return FALSE;
  3634. +        }
  3635. +
  3636. +      if (!amiga_write_symbols(abfd,p)) /* Write out symbols, incl HUNK_END */
  3637. +    return FALSE;
  3638. +
  3639. +    }/* of for sections */
  3640. +
  3641. +  /* Write out debug hunk, if requested */
  3642. +  if (amiga_data->IsLoadFile /*&& write_debug_hunk*/)
  3643. +    {
  3644. +      extern bfd_boolean
  3645. +    translate_to_native_sym_flags (bfd*, asymbol*, struct external_nlist*);
  3646. +
  3647. +      /* We have to convert all the symbols in abfd to a.out style.... */
  3648. +      struct external_nlist data;
  3649. +      int str_size, offset = 4;
  3650. +      int symbols = 0;
  3651. +      asymbol *sym;
  3652. +      asection *s;
  3653. +
  3654. +      if (abfd->symcount)
  3655. +    {
  3656. +      /* Now, set the .text, .data and .bss fields in the tdata
  3657. +         struct (because translate_to_native_sym_flags needs
  3658. +         them... */
  3659. +      for (i=0,s=abfd->sections;s!=NULL;s=s->next)
  3660. +        if (strcmp(s->name,".text")==0)
  3661. +          {
  3662. +        i|=1;
  3663. +        adata(abfd).textsec=s;
  3664. +          }
  3665. +        else if (strcmp(s->name,".data")==0)
  3666. +          {
  3667. +            i|=2;
  3668. +            adata(abfd).datasec=s;
  3669. +          }
  3670. +        else if (strcmp(s->name,".bss")==0)
  3671. +          {
  3672. +            i|=4;
  3673. +            adata(abfd).bsssec=s;
  3674. +          }
  3675. +
  3676. +      if (i!=7) /* One section missing... */
  3677. +        {
  3678. +          fprintf(stderr,"Missing section, hunk not written\n");
  3679. +          return TRUE;
  3680. +        }
  3681. +
  3682. +      str_size=4; /* the first 4 bytes will be replaced with the length */
  3683. +
  3684. +#define CAN_WRITE_OUTSYM(sym) (sym!=NULL && sym->section && \
  3685. +                ((sym->section->owner && \
  3686. +                 bfd_get_flavour (sym->section->owner) == \
  3687. +                 bfd_target_aout_flavour) || \
  3688. +                 bfd_asymbol_flavour(sym) == \
  3689. +                 bfd_target_aout_flavour))
  3690. +
  3691. +      for (i = 0; i < abfd->symcount; i++) /* Translate every symbol */
  3692. +        {
  3693. +          sym = abfd->outsymbols[i];
  3694. +          /* NULL entries have been written already.... */
  3695. +          if (CAN_WRITE_OUTSYM (sym))
  3696. +            {
  3697. +          str_size += strlen(sym->name) + 1;
  3698. +          symbols++;
  3699. +        }
  3700. +        }
  3701. +
  3702. +      /* Write out HUNK_DEBUG, size, 0413.... */
  3703. +      n[0] = HUNK_DEBUG;
  3704. +      n[1] = 3 + ((symbols * sizeof(struct internal_nlist) + str_size + 3) >> 2);
  3705. +      n[2] = 0413L; /* Magic number */
  3706. +      n[3] = symbols * sizeof(struct internal_nlist);
  3707. +      n[4] = str_size;
  3708. +      if (!write_longs ((PTR)(n), 5, abfd))
  3709. +        return FALSE;
  3710. +
  3711. +      /* Write out symbols */
  3712. +      for (i = 0; i < abfd->symcount; i++) /* Translate every symbol */
  3713. +        {
  3714. +          sym = abfd->outsymbols[i];
  3715. +          /* NULL entries have been written already.... */
  3716. +          if (CAN_WRITE_OUTSYM (sym))
  3717. +        {
  3718. +                {
  3719. +                      aout_symbol_type *t = (aout_symbol_type *)
  3720. +            &(sym)->the_bfd;
  3721. +
  3722. +                  bfd_h_put_16(abfd, t->desc, data.e_desc);
  3723. +                  bfd_h_put_8(abfd, t->other, data.e_other);
  3724. +                  bfd_h_put_8(abfd, t->type, data.e_type);
  3725. +            }
  3726. +            if (!translate_to_native_sym_flags(abfd,sym,&data))
  3727. +              {
  3728. +            fprintf (stderr, "Cannot translate flags for %s\n",
  3729. +                 sym->name);
  3730. +              }
  3731. +          PUT_WORD(abfd, offset, &(data.e_strx[0])); /* Store index */
  3732. +          offset += strlen(sym->name) + 1;
  3733. +              if (bfd_bwrite ((unsigned long *)&data,sizeof(long)*3,abfd)
  3734. +              != sizeof(long)*3)
  3735. +                return FALSE;
  3736. +          }
  3737. +        }
  3738. +
  3739. +      /* Write out strings */
  3740. +      if (!write_longs ((unsigned long *)&str_size, 1, abfd))
  3741. +        return FALSE;
  3742. +      
  3743. +      for (i = 0; i < abfd->symcount; i++) /* Translate every symbol */
  3744. +        {
  3745. +          sym = abfd->outsymbols[i];
  3746. +          /* NULL entries have been written already.... */
  3747. +          if (CAN_WRITE_OUTSYM (sym))
  3748. +        {
  3749. +          int len = strlen(sym->name) + 1;
  3750. +
  3751. +              /* Write string tab */
  3752. +              if (bfd_bwrite((PTR)(sym->name),sizeof(char)*len,abfd)!=len)
  3753. +                return FALSE;
  3754. +        }
  3755. +        }
  3756. +
  3757. +          i = ((str_size + 3) & (~3)) - str_size;
  3758. +          str_size = 0;
  3759. +      /* Write padding */
  3760. +      if (i && bfd_bwrite((PTR)(&str_size),sizeof(char)*i,abfd)!=i)
  3761. +        return FALSE;
  3762. +
  3763. +      /* write a HUNK_END here to finish the loadfile, or amigaos
  3764. +         will refuse to load it */
  3765. +      n[0]=HUNK_END;
  3766. +      if (!write_longs (n, 1, abfd))
  3767. +        return FALSE;
  3768. +    }/* Of if abfd->symcount */
  3769. +    }/* Of write out debug hunk */
  3770. +
  3771. +  bfd_release (abfd, index_map);
  3772. +  return TRUE;
  3773. +}
  3774. +
  3775. +/* Write a string padded to 4 bytes and preceded by it's length in
  3776. +   long words ORed with <value> */
  3777. +static bfd_boolean
  3778. +write_name (abfd, name, value)
  3779. +     bfd *abfd;
  3780. +     const char *name;
  3781. +     long value;
  3782. +{
  3783. +  long i,j;
  3784. +  struct name {
  3785. +    long len;
  3786. +    char buf[MAX_NAME_SIZE+3];
  3787. +  } n;
  3788. +
  3789. +  j = strlen (name);
  3790. +  if (j > MAX_NAME_SIZE)
  3791. +    j = MAX_NAME_SIZE;
  3792. +  strncpy (n.buf, name, j);
  3793. +  i = LONGSIZE (j) | value;
  3794. +  n.len = GL (&i);
  3795. +  if (j&3) {
  3796. +    n.buf[j] = n.buf[j+1] = n.buf[j+2] = '\0';
  3797. +    j += (4-(j&3))&3;
  3798. +  }
  3799. +  return (bfd_bwrite ((PTR)&n, sizeof(long)+j, abfd) == sizeof(long)+j);
  3800. +}
  3801. +
  3802. +static bfd_boolean
  3803. +amiga_write_archive_contents (arch)
  3804. +     bfd *arch;
  3805. +{
  3806. +  bfd *object;
  3807. +  char buffer[DEFAULT_BUFFERSIZE];
  3808. +  int i;
  3809. +  unsigned long n[2];
  3810. +  long size;
  3811. +  struct stat status;
  3812. +
  3813. +  for (object = arch->archive_head; object; object = object->next)
  3814. +    {
  3815. +      unsigned int remaining;
  3816. +
  3817. +      if (bfd_write_p (object))
  3818. +    {
  3819. +      bfd_set_error (bfd_error_invalid_operation);
  3820. +      return FALSE;
  3821. +    }
  3822. +
  3823. +      if (stat (object->filename, &status) != 0)
  3824. +    {
  3825. +      bfd_set_error (bfd_error_system_call);
  3826. +      return FALSE;
  3827. +    }
  3828. +
  3829. +      if (bfd_seek (object, (file_ptr) 0, SEEK_SET) != 0)
  3830. +    return FALSE;
  3831. +
  3832. +      remaining = status.st_size;
  3833. +
  3834. +      while (remaining)
  3835. +    {
  3836. +      unsigned int amt = DEFAULT_BUFFERSIZE;
  3837. +      if (amt > remaining)
  3838. +        amt = remaining;
  3839. +      errno = 0;
  3840. +      if (bfd_bread (buffer, amt, object) != amt)
  3841. +        {
  3842. +          if (bfd_get_error () != bfd_error_system_call)
  3843. +        bfd_set_error (bfd_error_malformed_archive);
  3844. +          return FALSE;
  3845. +        }
  3846. +      if (bfd_bwrite (buffer, amt, arch) != amt)
  3847. +        return FALSE;
  3848. +      remaining -= amt;
  3849. +    }
  3850. +    }
  3851. +    return TRUE;
  3852. +}
  3853. +
  3854. +static bfd_boolean
  3855. +amiga_write_armap (abfd)
  3856. +     bfd *abfd;
  3857. +{
  3858. +  return TRUE;
  3859. +}
  3860. +
  3861. +#define determine_size(type) (2 - ((type)>=3 ? (type)-3 : (type)))
  3862. +
  3863. +static int
  3864. +determine_type (r)
  3865. +     struct reloc_cache_entry *r;
  3866. +{
  3867. +  switch (r->howto->type) /* FIXME: Is this sufficient to distinguish them ?*/
  3868. +    {
  3869. +      /* AMIGA specific */
  3870. +      case HUNK_RELOC8:
  3871. +      case HUNK_RELOC16:
  3872. +      case HUNK_RELOC32:
  3873. +      case HUNK_DREL8:
  3874. +      case HUNK_DREL16:
  3875. +      case HUNK_DREL32:
  3876. +        if (r->howto->type >= HUNK_DREL32)
  3877. +          return 3 + r->howto->type - HUNK_DREL32;
  3878. +        return r->howto->type - HUNK_RELOC32;
  3879. +
  3880. +      /* Now, these may occur, if a.out was used as input */
  3881. +      case 0: /* 8 bit ref */
  3882. +        return 2;
  3883. +
  3884. +      case 1: /* 16 bit relative */
  3885. +        return 1;
  3886. +
  3887. +      case 2: /* 32 bit relative */
  3888. +        return 0;
  3889. +
  3890. +      case 9: /* 16 bit base rel */
  3891. +        return 4;
  3892. +
  3893. +      case 10: /* 32 bit baserel */
  3894. +        return 3;
  3895. +
  3896. +      /* FIXME: There are other (pc relative) displacements left */
  3897. +      default: /* Error, can't represent this */
  3898. +        bfd_set_error(bfd_error_nonrepresentable_section);
  3899. +        return -1;
  3900. +    }/* Of switch */
  3901. +}
  3902. +
  3903. +#define MAX_RELOC_OUT 3
  3904. +
  3905. +static unsigned long reloc_types[]= {
  3906. +  HUNK_RELOC32, HUNK_RELOC16, HUNK_RELOC8
  3907. +/* these reloc types are not supported at the moment */
  3908. +#if 0
  3909. +  HUNK_DREL32,  HUNK_DREL16,  HUNK_DREL8
  3910. +#endif
  3911. +};
  3912. +
  3913. +#define NB_RELOC_TYPES (sizeof(reloc_types) / sizeof(reloc_types[0]))
  3914. +
  3915. +/* Write out section contents, including relocs */
  3916. +static bfd_boolean
  3917. +amiga_write_section_contents (abfd, section, data_sec, datadata_relocs,
  3918. +                  index_map)
  3919. +     bfd *abfd;
  3920. +     asection *section;
  3921. +     asection *data_sec;
  3922. +     long datadata_relocs;
  3923. +     long *index_map;
  3924. +{
  3925. +  static const char zero[3]={0,0,0};
  3926. +  unsigned long n[2];
  3927. +  int i, j, type, size;
  3928. +  unsigned int k;
  3929. +  struct reloc_cache_entry *r;
  3930. +  asection *osection, *sec, *insection;
  3931. +  asymbol *sym_p;
  3932. +  int pad, reloc_count = 0;
  3933. +  unsigned long disksize;
  3934. +  int max_hunk = -1;
  3935. +  char *c_p;
  3936. +  unsigned char *values;
  3937. +  long *reloc_counts;
  3938. +
  3939. +  DPRINT(5, ("Entered Write-section-conts\n"));
  3940. +
  3941. +  /* Compute the maximum hunk number of the ouput file */
  3942. +  sec = abfd->sections;
  3943. +  while (sec) {
  3944. +    max_hunk++;
  3945. +    sec = sec->next;
  3946. +  }
  3947. +
  3948. +  /* If we are base-relative linking and the section is .bss and abfd
  3949. +     is a load file, then return */
  3950. +  if (AMIGA_DATA(abfd)->IsLoadFile)
  3951. +    {
  3952. +      if (amiga_base_relative && (strcmp(section->name, ".bss") == 0))
  3953. +    return TRUE; /* Nothing to do */
  3954. +    }
  3955. +  else
  3956. +    {
  3957. +      /* WRITE out HUNK_NAME + section name */
  3958. +      n[0] = HUNK_NAME;
  3959. +      if (!write_longs (n, 1, abfd) || !write_name (abfd, section->name, 0))
  3960. +    return FALSE;
  3961. +    }
  3962. +
  3963. +  /* Depending on the type of the section, write out HUNK_{CODE|DATA|BSS} */
  3964. +  if (section->flags & SEC_CODE) /* Code section */
  3965. +    n[0] = HUNK_CODE;
  3966. +  else if (section->flags & (SEC_DATA | SEC_LOAD)) /* data section */
  3967. +    n[0] = HUNK_DATA;
  3968. +  else if (section->flags & SEC_ALLOC) /* BSS */
  3969. +    n[0] = HUNK_BSS;
  3970. +  else if (section->flags & SEC_DEBUGGING) /* debug section */
  3971. +    n[0] = HUNK_DEBUG;
  3972. +  else /* Error */
  3973. +    {
  3974. +#if 0
  3975. +      bfd_set_error(bfd_error_nonrepresentable_section);
  3976. +      return(FALSE);
  3977. +#else
  3978. +      /* FIXME: Just dump everything we don't currently recognize into
  3979. +     a DEBUG hunk. */
  3980. +      n[0] = HUNK_DEBUG;
  3981. +#endif
  3982. +    }
  3983. +
  3984. +  DPRINT(10,("Section type is %lx\n",n[0]));
  3985. +
  3986. +  /* Get real size in n[1], this may be shorter than the size in the header */
  3987. +  disksize = LONGSIZE (amiga_per_section(section)->disk_size) + datadata_relocs;
  3988. +  pad = (4-(amiga_per_section(section)->disk_size & 3)) & 3;
  3989. +  n[1] = disksize;
  3990. +
  3991. +  /* in a load file, we put section attributes only in the header */
  3992. +  if (!(AMIGA_DATA(abfd)->IsLoadFile))
  3993. +    {
  3994. +      /* Get attribute for section */
  3995. +      switch (amiga_per_section(section)->attribute)
  3996. +    {
  3997. +    case MEMF_CHIP:
  3998. +      n[1] |= HUNKF_CHIP;
  3999. +      break;
  4000. +    case MEMF_FAST:
  4001. +      n[1] |= HUNKF_FAST;
  4002. +      break;
  4003. +    case 0:
  4004. +      break;
  4005. +    default: /* error , can't represent this */
  4006. +      bfd_set_error(bfd_error_nonrepresentable_section);
  4007. +      return(FALSE);
  4008. +      break;
  4009. +    }
  4010. +    }/* Of switch */
  4011. +
  4012. +  if (!write_longs (n, 2, abfd))
  4013. +      return FALSE;
  4014. +
  4015. +  DPRINT(5,("Wrote code and size=%lx\n",n[1]));
  4016. +
  4017. +  /* If a BSS hunk, we're done, else write out section contents */
  4018. +  if (HUNK_VALUE(n[0]) == HUNK_BSS)
  4019. +    return TRUE;
  4020. +
  4021. +  DPRINT(5,("Non bss hunk...\n"));
  4022. +
  4023. +  /* Traverse through the relocs, sample them in reloc_data, adjust section
  4024. +     data to get 0 addend
  4025. +     Then compactify reloc_data
  4026. +     Set the entry in the section for the reloc to NULL */
  4027. +
  4028. +  if (disksize != 0)
  4029. +    BFD_ASSERT((section->flags & SEC_IN_MEMORY) != 0);
  4030. +
  4031. +  reloc_counts  = (long*) bfd_alloc (abfd, NB_RELOC_TYPES * (max_hunk+1)
  4032. +                     * sizeof (long));
  4033. +  if (!reloc_counts)
  4034. +    return FALSE;
  4035. +  bzero (reloc_counts, NB_RELOC_TYPES*(max_hunk+1)*sizeof (long));
  4036. +
  4037. +  DPRINT(5,("Section has %d relocs\n", section->reloc_count));
  4038. +
  4039. +  for (i = 0; i < section->reloc_count; i++)
  4040. +    {
  4041. +      r = section->orelocation[i];
  4042. +      if (r == NULL)
  4043. +        continue;
  4044. +      sym_p = *(r->sym_ptr_ptr); /* The symbol for this section */
  4045. +      insection = sym_p->section;
  4046. +      DPRINT(5,("Sec for reloc is %lx(%s)\n",insection,insection->name));
  4047. +      DPRINT(5,("Symbol for this reloc is %lx(%s)\n",sym_p, sym_p->name));
  4048. +
  4049. +      /* Is reloc relative to a special section ? */
  4050. +      if ((insection == bfd_abs_section_ptr) ||
  4051. +      (insection == bfd_com_section_ptr) ||
  4052. +      (insection == bfd_und_section_ptr) ||
  4053. +      (insection == bfd_ind_section_ptr))
  4054. +    continue; /* Nothing to do, since this translates to HUNK_EXT */
  4055. +
  4056. +      r->addend += sym_p->value; /* Add offset of symbol from section start */
  4057. +
  4058. +      /* Address of reloc has been unchanged since original reloc, or has been
  4059. +     adjusted by get_relocated_section_contents. */
  4060. +      /* For relocs, the vma of the target section is in the data, the
  4061. +     addend is -vma of that section =>No need to add vma*/
  4062. +      /* Add in offset */
  4063. +      r->addend += insection->output_offset;
  4064. +      osection = insection->output_section; /* target section */
  4065. +
  4066. +      /* Determine which hunk to write, and index of target */
  4067. +      j = index_map[osection->index];
  4068. +
  4069. +      if (j<0 || j>max_hunk) {
  4070. +    fprintf (stderr, "erroneous relocation to hunk %d\n", j);
  4071. +    BFD_FAIL ();
  4072. +      }
  4073. +
  4074. +      type = determine_type(r);
  4075. +      if (type == -1)
  4076. +    return FALSE;
  4077. +      size = determine_size(type);
  4078. +
  4079. +      if (type < NB_RELOC_TYPES)
  4080. +    reloc_counts[type+(j*NB_RELOC_TYPES)]++;
  4081. +      else {
  4082. +    bfd_set_error (bfd_error_nonrepresentable_section);
  4083. +    return FALSE;
  4084. +      }
  4085. +
  4086. +      c_p = ((char *)(section->contents)) + r->address;
  4087. +      DPRINT(5,("reloc address=%lx,addend=%lx\n",r->address,r->addend));
  4088. +
  4089. +      /* There is no error checking with these.. */
  4090. +      values = (unsigned char *)c_p;
  4091. +      switch (size)
  4092. +    {
  4093. +    case 0: /* adjust byte */
  4094. +      j = (int)(*c_p) + r->addend;
  4095. +      *c_p = (signed char)j;
  4096. +      break;
  4097. +    case 1: /* Adjust word */
  4098. +      k = values[1] | (values[0] << 8);
  4099. +      j = (int)k + r->addend;
  4100. +      values[0] = (j & 0xff00) >> 8;
  4101. +      values[1] = j & 0xff;
  4102. +      break;
  4103. +    case 2: /* adjust long */
  4104. +      k = values[3] | (values[2] << 8) | (values[1] << 16) |
  4105. +        (values[0] << 24);
  4106. +      j = (int)k + r->addend;
  4107. +      values[3] = j & 0xff;
  4108. +      values[2] = (j & 0xff00) >> 8;
  4109. +      values[1] = (j & 0xff0000) >> 16;
  4110. +      values[0] = ((unsigned int)j & 0xff000000) >> 24;
  4111. +      break;
  4112. +    } /* of switch */
  4113. +
  4114. +      r->addend = 0;
  4115. +      DPRINT(5,("Did adjusting\n"));
  4116. +
  4117. +      if (type < MAX_RELOC_OUT)
  4118. +        reloc_count++;
  4119. +      else
  4120. +        section->orelocation[i] = NULL;
  4121. +    } /* of for i */
  4122. +
  4123. +  DPRINT(5,("Did all relocs\n"));
  4124. +
  4125. +  /* We applied all the relocs, as far as possible to obtain 0 addend fields */
  4126. +  /* Write the section contents */
  4127. +  if (amiga_per_section(section)->disk_size != 0)
  4128. +    {
  4129. +      if (bfd_bwrite((PTR)(section->contents), sizeof(char) *
  4130. +            amiga_per_section(section)->disk_size, abfd) !=
  4131. +      amiga_per_section(section)->disk_size)
  4132. +    return FALSE;
  4133. +    }
  4134. +
  4135. +  /* pad the section on disk if necessary (to a long boundary) */
  4136. +  if (pad!=0 && (bfd_bwrite (zero, pad, abfd) != pad))
  4137. +    return FALSE;
  4138. +
  4139. +#if 0
  4140. +  /* write bss data in the data hunk if needed */
  4141. +  i = 0;
  4142. +  while (bss_size--)
  4143. +    if (!write_longs((PTR)&i, 1, abfd))
  4144. +      return FALSE;
  4145. +#endif
  4146. +
  4147. +  if (datadata_relocs)
  4148. +    {
  4149. +      datadata_relocs--;
  4150. +      if (!write_longs (&datadata_relocs, 1, abfd))
  4151. +        return FALSE;
  4152. +      for (i = 0; i < data_sec->reloc_count; i++)
  4153. +        {
  4154. +          r = data_sec->orelocation[i];
  4155. +          if (r == NULL)
  4156. +            continue;
  4157. +          sym_p = *(r->sym_ptr_ptr); /* The symbol for this section */
  4158. +          insection = sym_p->section;
  4159. +
  4160. +          /* Is reloc relative to a special section ? */
  4161. +          if ((insection == bfd_abs_section_ptr) ||
  4162. +          (insection == bfd_com_section_ptr) ||
  4163. +              (insection == bfd_und_section_ptr) ||
  4164. +          (insection == bfd_ind_section_ptr))
  4165. +            continue; /* Nothing to do, since this translates to HUNK_EXT */
  4166. +
  4167. +      if (insection->output_section == data_sec)
  4168. +        {
  4169. +          if (determine_type(r) == 0)
  4170. +        if (!write_longs ((PTR)&r->address, 1, abfd))
  4171. +          return FALSE;
  4172. +        }
  4173. +    }
  4174. +    }
  4175. +  DPRINT(10,("Wrote contents, writing relocs now\n"));
  4176. +
  4177. +
  4178. +  if (reloc_count) {
  4179. +    while (reloc_count) {
  4180. +      /* Sample every reloc type */
  4181. +      for (i = 0; i < NB_RELOC_TYPES; i++) {
  4182. +    int written = FALSE;
  4183. +    for (j = 0; j <= max_hunk; j++) {
  4184. +      long relocs;
  4185. +      while ((relocs = reloc_counts [i+(j*NB_RELOC_TYPES)]) > 0) {
  4186. +        if (!written)
  4187. +          if (!write_longs(&reloc_types[i], 1, abfd))
  4188. +        return FALSE;
  4189. +          else
  4190. +        written = TRUE;
  4191. +
  4192. +        if (relocs > 0xffff)
  4193. +          relocs = 0xffff;
  4194. +
  4195. +        reloc_counts [i+(j*NB_RELOC_TYPES)] -= relocs;
  4196. +        n[0] = relocs;
  4197. +        n[1] = j;
  4198. +        if (!write_longs(n, 2, abfd))
  4199. +          return FALSE;
  4200. +        reloc_count -= relocs;
  4201. +
  4202. +        for (k = 0; k < section->reloc_count; k++) {
  4203. +          int jj;
  4204. +
  4205. +          r = section->orelocation[k];
  4206. +          if (r == NULL)    /* already written */
  4207. +        continue;
  4208. +          sym_p = *(r->sym_ptr_ptr); /* The symbol for this section */
  4209. +          insection = sym_p->section;
  4210. +          /* Is reloc relative to a special section ? */
  4211. +          if ((insection == bfd_abs_section_ptr) ||
  4212. +          (insection == bfd_com_section_ptr) ||
  4213. +          (insection == bfd_und_section_ptr) ||
  4214. +          (insection == bfd_ind_section_ptr))
  4215. +        /* Nothing to do, since this translates to HUNK_EXT */
  4216. +        continue;
  4217. +
  4218. +          osection = insection->output_section; /* target section */
  4219. +
  4220. +#if 0
  4221. +          /* Determine which hunk to write, and index of target */
  4222. +          for (jj = 0, sec = abfd->sections; sec != NULL;
  4223. +           sec = sec->next, jj++) {
  4224. +        if (sec == osection)
  4225. +          break;
  4226. +          }
  4227. +
  4228. +          BFD_ASSERT (jj==index_map[insection->output_section->index]);
  4229. +#else
  4230. +          jj=index_map[insection->output_section->index];
  4231. +#endif
  4232. +          if (jj == j && i == determine_type(r)) {
  4233. +        section->orelocation[k] = NULL;
  4234. +        if (!write_longs((PTR)&r->address, 1, abfd))
  4235. +          return FALSE;
  4236. +        if (--relocs == 0)
  4237. +          break;
  4238. +          }
  4239. +        }
  4240. +      }
  4241. +    }
  4242. +      }
  4243. +    }
  4244. +    /* write a zero to finish the relocs */
  4245. +    if (!write_longs((PTR)&reloc_count, 1, abfd))
  4246. +      return FALSE;
  4247. +  }
  4248. +  bfd_release (abfd, reloc_counts);
  4249. +  DPRINT(5,("Leaving write_section...\n"));
  4250. +  return TRUE;
  4251. +}
  4252. +
  4253. +
  4254. +/* Write out symbol information, including HUNK_EXT, DEFS, ABS. 
  4255. +   In the case, we were linking base relative, the symbols of the .bss
  4256. +   hunk have been converted already to belong to the .data hunk */
  4257. +
  4258. +static bfd_boolean
  4259. +amiga_write_symbols (abfd, section)
  4260. +     bfd *abfd;
  4261. +     asection *section;
  4262. +{
  4263. +
  4264. +  int i,j;
  4265. +  struct reloc_cache_entry *r;
  4266. +  asection *osection;
  4267. +  asymbol *sym_p;
  4268. +  char b[3]="\0\0\0";
  4269. +  unsigned long n[3];
  4270. +  int symbol_count;
  4271. +  unsigned long symbol_header;
  4272. +  unsigned long type, tmp;
  4273. +  int len;
  4274. +
  4275. +  /* If base rel linking and section is .bss ==> exit */
  4276. +  if (amiga_base_relative && (strcmp(section->name,".bss")==0))
  4277. +    return TRUE;
  4278. +
  4279. +  if (section->reloc_count==0 && abfd->symcount==0)
  4280. +    {/* Write HUNK_END */
  4281. +    alldone:
  4282. +      DPRINT(5,("Leaving write_symbols\n"));
  4283. +      n[0]=HUNK_END;
  4284. +      return write_longs ((PTR)n, 1, abfd);
  4285. +    }
  4286. +
  4287. +  symbol_count=0;
  4288. +  symbol_header=HUNK_EXT;
  4289. +
  4290. +  /* If this is Loadfile, then do not write HUNK_EXT, but rather HUNK_SYMB*/
  4291. +
  4292. + /* Write out all the symbol definitions, then HUNK_END 
  4293. +
  4294. +     Now, first traverse the relocs, all entries that are non NULL
  4295. +     have to be taken into account */
  4296. +  /* Determine the type of HUNK_EXT to issue and build a single
  4297. +     HUNK_EXT subtype */
  4298. +
  4299. +
  4300. +  /*FIXME: We write out many HUNK_EXT's entries for references to the
  4301. +    same symbol.. */
  4302. +  for (i=0;i<section->reloc_count;i++)
  4303. +    {
  4304. +      r=section->orelocation[i];
  4305. +
  4306. +      if (r==NULL) /* Empty entry */
  4307. +    continue;
  4308. +
  4309. +      sym_p=*(r->sym_ptr_ptr); /* The symbol for this section */
  4310. +      osection=sym_p->section; /* The section the symbol belongs to */
  4311. +      /* this section MUST be a special section */
  4312. +
  4313. +      DPRINT(5,("Symbol is %s, section is %lx(%s)\n",sym_p->name,osection,osection->name));
  4314. +
  4315. +      if (osection!=bfd_com_section_ptr) /* Not common symbol */
  4316. +    {
  4317. +      DPRINT(5,("Non common ref\n"));
  4318. +      /* Add a reference to this HUNK */
  4319. +      if ((symbol_count++)==0) /* First write out the HUNK_EXT */
  4320. +        {
  4321. +          tmp=HUNK_EXT;
  4322. +          if (!write_longs(&tmp, 1, abfd))
  4323. +        return FALSE;
  4324. +        }
  4325. +
  4326. +      /* Determine type of ref */
  4327. +      switch(r->howto->type)
  4328. +        {
  4329. +          /* AMIGA specific */
  4330. +        case 0:
  4331. +        case HUNK_RELOC8:
  4332. +          type=EXT_REF8;
  4333. +          break;
  4334. +
  4335. +        case 1:
  4336. +        case HUNK_RELOC16:
  4337. +          type=EXT_REF16;
  4338. +          break;
  4339. +
  4340. +        case 2:
  4341. +        case HUNK_RELOC32:
  4342. +          type=EXT_REF32;
  4343. +          break;
  4344. +        case HUNK_DREL8:
  4345. +          type=EXT_DEXT8;
  4346. +          break;
  4347. +
  4348. +        case 9:
  4349. +        case HUNK_DREL16:
  4350. +          type=EXT_DEXT16;
  4351. +          break;
  4352. +
  4353. +        case 10:
  4354. +        case HUNK_DREL32:
  4355. +            type=EXT_DEXT32;
  4356. +          break;
  4357. +          
  4358. +          /* FIXME: There are other (pc relative) displacements left */
  4359. +        default: /* Error, can't represent this */
  4360. +          bfd_set_error(bfd_error_nonrepresentable_section);
  4361. +          return FALSE;
  4362. +          break;
  4363. +        }/* Of switch */
  4364. +      DPRINT(5,("Type is %x\n",type));
  4365. +
  4366. +      if (!write_name (abfd, sym_p->name, type << 24))
  4367. +        return FALSE;
  4368. +      n[0]=1; /* 1 ref at address... */
  4369. +      n[1]=r->address;
  4370. +      if (!write_longs (n, 2, abfd))
  4371. +        return FALSE;
  4372. +
  4373. +      continue; /* Next relocation */
  4374. +    }/* Of is ref to undefined or abs symbol */
  4375. +
  4376. +      else /* ref to common symbol */
  4377. +    {
  4378. +      DPRINT(5,("Common ref\n"));
  4379. +
  4380. +      /* If the reference is NOT 32 bit wide absolute , then issue warning */
  4381. +      if ((r->howto->type!=2)&&(r->howto->type!=HUNK_RELOC32))
  4382. +        fprintf(stderr,"Warning: Non 32 bit wide reference to common symbol %s\n",
  4383. +            sym_p->name);
  4384. +
  4385. +      if ((symbol_count++)==0) /* First write out the HUNK_EXT */
  4386. +        {
  4387. +          tmp=HUNK_EXT;
  4388. +          if (!write_longs (&tmp, 1, abfd))
  4389. +        return FALSE;
  4390. +        }
  4391. +
  4392. +      if (!write_name (abfd, sym_p->name, EXT_COMMON<<24))
  4393. +        return FALSE;
  4394. +      n[0]=sym_p->value; /* Size of common block */
  4395. +      n[1]=1;
  4396. +      n[2]=r->address;
  4397. +      if (!write_longs (n, 3, abfd))
  4398. +        return FALSE;
  4399. +
  4400. +      continue;
  4401. +    }/* Of is common section */
  4402. +
  4403. +      DPRINT(10,("Failing...\n"));
  4404. +      BFD_FAIL();
  4405. +    }/* Of traverse relocs */
  4406. +      
  4407. +      
  4408. +  /* Now traverse the symbol table and write out all definitions, that are relative
  4409. +     to this hunk */
  4410. +  /* Absolute defs are always only written out with the first hunk */
  4411. +  /* Don't write out local symbols
  4412. +                     undefined symbols
  4413. +             indirect symbols
  4414. +             warning symbols
  4415. +             debugging symbols
  4416. +             warning symbols
  4417. +             constructor symbols, since they are unrepresentable in HUNK format..*/
  4418. +
  4419. +  DPRINT(10,("Traversing symbol table\n"));
  4420. +  symbol_header=(AMIGA_DATA(abfd)->IsLoadFile)?HUNK_SYMBOL:HUNK_EXT;
  4421. +  for (i=0;i<abfd->symcount;i++)
  4422. +    {
  4423. +      sym_p=abfd->outsymbols[i];
  4424. +      osection=sym_p->section;
  4425. +
  4426. +      DPRINT(5,("%d. symbol(%s), osec=%x(%s)\n",i,sym_p->name,osection,osection->name));
  4427. +
  4428. +      if ((osection==bfd_und_section_ptr)/*||(osection==bfd_com_section_ptr)*/||
  4429. +      (osection==bfd_ind_section_ptr))
  4430. +    continue; /* Don't write these */
  4431. +
  4432. +      /* Only write abs defs, if not writing A Loadfile */
  4433. +      if ((osection==bfd_abs_section_ptr)&&(section->index==0)&&
  4434. +      !AMIGA_DATA(abfd)->IsLoadFile) /* Write out abs defs */
  4435. +    {
  4436. +      DPRINT(5,("Abs symbol\n"));
  4437. +      /* don't write debug symbols, they will be written in a
  4438. +             HUNK_DEBUG later on */
  4439. +      if (sym_p->flags & BSF_DEBUGGING)
  4440. +        continue;
  4441. +
  4442. +      if ((symbol_count++)==0) /* First write out the HUNK_EXT */
  4443. +        {
  4444. +          if (!write_longs (&symbol_header, 1, abfd))
  4445. +        return FALSE;
  4446. +        }
  4447. +
  4448. +      if (!write_name (abfd, sym_p->name, EXT_ABS << 24))
  4449. +        return FALSE;
  4450. +      n[0]=sym_p->value;
  4451. +      if (!write_longs (n, 1,abfd))
  4452. +        return FALSE;
  4453. +      continue;
  4454. +    }/* Of abs def */
  4455. +      if (osection == NULL) /* Happens with constructor functions. FIXME */
  4456. +        continue;
  4457. +      if (osection==bfd_abs_section_ptr) /* Not first hunk. Already written */
  4458. +    continue;
  4459. +
  4460. +      /* If it is a warning symbol, or a constructor symbol or a
  4461. +     debugging or a local symbol, don't write it */
  4462. +      if (sym_p->flags & (BSF_WARNING|BSF_CONSTRUCTOR|BSF_DEBUGGING|BSF_LOCAL))
  4463. +    continue;
  4464. +
  4465. +      if (!(sym_p->flags & BSF_GLOBAL))
  4466. +    continue;
  4467. +
  4468. +      /* Now, if osection==section, write it out */
  4469. +      if (osection->output_section==section)
  4470. +    {
  4471. +      DPRINT(5,("Writing it out\n"));
  4472. +
  4473. +      if ((symbol_count++)==0) /* First write out the header */
  4474. +        {
  4475. +          if (!write_longs (&symbol_header, 1, abfd))
  4476. +        return FALSE;
  4477. +        }
  4478. +      type=((symbol_header==HUNK_EXT?EXT_DEF:0)<<24)&0xff000000;
  4479. +
  4480. +      if (!write_name (abfd, sym_p->name, type))
  4481. +        return FALSE;
  4482. +      n[0] = sym_p->value + sym_p->section->output_offset;
  4483. +      if (!write_longs (n, 1, abfd))
  4484. +        return FALSE;
  4485. +    }
  4486. +      else
  4487. +    {
  4488. +      /* write common definitions as bss common references */
  4489. +      if (osection->output_section == bfd_com_section_ptr &&
  4490. +          section->index == 2)
  4491. +        {
  4492. +          if ((symbol_count++)==0) /* First write out the header */
  4493. +        {
  4494. +          if (!write_longs (&symbol_header, 1, abfd))
  4495. +            return FALSE;
  4496. +        }
  4497. +          if (!write_name (abfd, sym_p->name, EXT_COMMON<<24))
  4498. +        return FALSE;
  4499. +
  4500. +          n[0]=sym_p->value;
  4501. +          n[1]=0;
  4502. +          if (!write_longs (n, 2, abfd))
  4503. +        return FALSE;
  4504. +        }
  4505. +    }
  4506. +    }/* Of for */
  4507. +
  4508. +  DPRINT(10,("Did traversing\n"));
  4509. +  if (symbol_count) /* terminate HUNK_EXT, HUNK_SYMBOL */
  4510. +    {
  4511. +      n[0]=0;
  4512. +      if (!write_longs (n, 1, abfd))
  4513. +    return FALSE;
  4514. +    }
  4515. +  DPRINT(5,("Leaving\n"));
  4516. +  goto alldone; /* Write HUNK_END, return */
  4517. +}
  4518. +
  4519. +static bfd_boolean
  4520. +amiga_get_section_contents (abfd, section, location, offset, count)
  4521. +     bfd *abfd;
  4522. +     sec_ptr section;
  4523. +     PTR location;
  4524. +     file_ptr offset;
  4525. +     bfd_size_type count;
  4526. +{
  4527. +  long disk_size = amiga_per_section (section)->disk_size;
  4528. +
  4529. +  if (bfd_seek (abfd, section->filepos + offset, SEEK_SET))
  4530. +    return FALSE;
  4531. +
  4532. +  if (offset+count > disk_size) {
  4533. +    /* the section's size on disk may be smaller than in memory
  4534. +       in this case, pad the contents */
  4535. +    if (bfd_bread (location, disk_size-offset, abfd) != disk_size-offset)
  4536. +      return FALSE;
  4537. +    memset ((char *) location + disk_size - offset, 0, count-(disk_size-offset));
  4538. +  }
  4539. +  else {
  4540. +    if (bfd_bread (location, count, abfd) != disk_size-offset)
  4541. +      return FALSE;
  4542. +  }
  4543. +  return TRUE;
  4544. +}
  4545. +
  4546. +
  4547. +bfd_boolean
  4548. +amiga_new_section_hook (abfd, newsect)
  4549. +     bfd *abfd;
  4550. +     asection *newsect;
  4551. +{
  4552. +  newsect->used_by_bfd = (PTR) bfd_zalloc (abfd,
  4553. +                       sizeof (amiga_per_section_type));
  4554. +  newsect->alignment_power = 2;
  4555. +  amiga_per_section(newsect)->reloc_tail = NULL;
  4556. +  if (!strcmp (newsect->name, ".data_chip") || !strcmp (newsect->name,
  4557. +                               ".bss_chip"))
  4558. +      amiga_per_section(newsect)->attribute |= MEMF_CHIP;
  4559. +  return TRUE;
  4560. +}
  4561. +
  4562. +static bfd_boolean
  4563. +amiga_slurp_symbol_table (abfd)
  4564. +     bfd *abfd;
  4565. +{
  4566. +  amiga_data_type *amiga_data=AMIGA_DATA(abfd);
  4567. +  asection *section;
  4568. +  struct amiga_raw_symbol *sp;
  4569. +  amiga_symbol_type *asp=NULL;
  4570. +  unsigned long *lp, l, buf[4];
  4571. +  unsigned long len, type;
  4572. +
  4573. +  if (amiga_data->symbols)
  4574. +    return TRUE; /* already read */
  4575. +
  4576. +  if (abfd->symcount)
  4577. +    asp = (amiga_symbol_type*) bfd_alloc (abfd, sizeof (amiga_symbol_type) *
  4578. +                         abfd->symcount);
  4579. +  else
  4580. +    return TRUE;
  4581. +
  4582. +  if (abfd->symcount!=0 && !asp) {
  4583. +    bfd_set_error (bfd_error_no_memory);
  4584. +    return FALSE;
  4585. +  }
  4586. +
  4587. +  amiga_data->symbols = asp;
  4588. +
  4589. +  /* Symbols are associated with every section */
  4590. +  for (section=abfd->sections; section!=NULL; section=section->next)
  4591. +    {
  4592. +      if (amiga_per_section(section)->hunk_ext_pos == 0)
  4593. +    continue;
  4594. +
  4595. +      if (bfd_seek (abfd, amiga_per_section(section)->hunk_ext_pos, SEEK_SET))
  4596. +    return FALSE;
  4597. +
  4598. +      amiga_per_section(section)->amiga_symbols = asp;
  4599. +
  4600. +      while (get_long (abfd, &l) && (l!=0))
  4601. +    {
  4602. +      type = l>>24;    /* type of entry */
  4603. +      len = (l & 0xffffff) << 2; /* namelength */
  4604. +
  4605. +      /* read the name */
  4606. +      if ((asp->symbol.name = bfd_alloc (abfd ,len+1))==NULL)
  4607. +        {
  4608. +          bfd_set_error (bfd_error_no_memory);
  4609. +          return FALSE;
  4610. +        }
  4611. +      if (bfd_bread ((PTR)asp->symbol.name, len, abfd) != len)
  4612. +        return FALSE;
  4613. +      ((char*)asp->symbol.name)[len] = '\0';
  4614. +
  4615. +      asp->symbol.the_bfd = abfd;
  4616. +      asp->type = type;
  4617. +      asp->symbol.flags = BSF_GLOBAL;
  4618. +      asp->index = asp - amiga_data->symbols;
  4619. +
  4620. +      switch(type) {
  4621. +      case EXT_COMMON: /* Common reference/definition*/
  4622. +        asp->symbol.section = bfd_com_section_ptr;
  4623. +        asp->hunk_number = -3;
  4624. +        /* size of common block -> symbol's value */
  4625. +        if (!get_long (abfd, &l))
  4626. +          return FALSE;
  4627. +        asp->symbol.value = l;
  4628. +        /* skip refs */
  4629. +        if (!(get_long (abfd, &l) && bfd_seek (abfd, l<<2, SEEK_CUR)==0))
  4630. +          return FALSE;
  4631. +        break;
  4632. +      case EXT_ABS: /* Absolute */
  4633. +        asp->symbol.section = bfd_abs_section_ptr;
  4634. +        asp->hunk_number = -1;
  4635. +        goto rval;
  4636. +        break;
  4637. +      case EXT_DEF: /* Relative Definition */
  4638. +      case EXT_SYMB: /* Same as EXT_DEF for load files */
  4639. +        asp->symbol.section = section;
  4640. +        asp->hunk_number = section->target_index;
  4641. +      rval:
  4642. +        /* read the value */
  4643. +        if (get_long (abfd, &l))
  4644. +          asp->symbol.value = l;
  4645. +        else
  4646. +          return FALSE;
  4647. +        break;
  4648. +
  4649. +      default: /* References to an undefined symbol */
  4650. +        asp->symbol.section = bfd_und_section_ptr;
  4651. +        asp->hunk_number = -2; /* undefined */
  4652. +        asp->symbol.flags = 0;
  4653. +        /* skip refs */
  4654. +        if (!(get_long (abfd, &l) && bfd_seek (abfd, l<<2, SEEK_CUR)==0))
  4655. +          return FALSE;
  4656. +        break;
  4657. +      }
  4658. +      asp++;
  4659. +    }
  4660. +    }
  4661. +  return TRUE;
  4662. +}
  4663. +
  4664. +
  4665. +/* Get size of symtab */
  4666. +long
  4667. +amiga_get_symtab_upper_bound (abfd)
  4668. +     bfd *abfd;
  4669. +{
  4670. +  if (!amiga_slurp_symbol_table (abfd))
  4671. +    return -1;
  4672. +   return (abfd->symcount+1) * (sizeof (amiga_symbol_type *));
  4673. +}
  4674. +
  4675. +long
  4676. +amiga_get_symtab (abfd, location)
  4677. +     bfd *abfd;
  4678. +     asymbol **location;
  4679. +{
  4680. +  amiga_symbol_type *symp;
  4681. +  int i=0;
  4682. +
  4683. +  if(!amiga_slurp_symbol_table(abfd))
  4684. +    return -1;
  4685. +
  4686. +  if (abfd->symcount)
  4687. +    {
  4688. +      for (symp = AMIGA_DATA(abfd)->symbols; i < bfd_get_symcount (abfd);
  4689. +       i++, symp++)
  4690. +    *location++ = &symp->symbol;
  4691. +    }
  4692. +  return abfd->symcount;
  4693. +}
  4694. +
  4695. +asymbol *
  4696. +amiga_make_empty_symbol (abfd)
  4697. +     bfd *abfd;
  4698. +{
  4699. +  amiga_symbol_type *new =
  4700. +    (amiga_symbol_type *) bfd_zalloc (abfd, sizeof (amiga_symbol_type));
  4701. +  new->symbol.the_bfd = abfd;
  4702. +  return &new->symbol;
  4703. +}
  4704. +
  4705. +
  4706. +
  4707. +void
  4708. +amiga_get_symbol_info (ignore_abfd, symbol, ret)
  4709. +      bfd *ignore_abfd;
  4710. +      asymbol *symbol;
  4711. +      symbol_info *ret;
  4712. +{
  4713. +  bfd_symbol_info (symbol, ret);
  4714. +  if (symbol->name[0] == ' ')
  4715. +    ret->name = "* empty table entry ";
  4716. +  if (symbol->section==bfd_abs_section_ptr)
  4717. +    ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A';
  4718. +}
  4719. +
  4720. +
  4721. +
  4722. +void
  4723. +amiga_print_symbol (abfd, afile,  symbol, how)
  4724. +      bfd *abfd;
  4725. +      PTR afile;
  4726. +      asymbol *symbol;
  4727. +      bfd_print_symbol_type how;
  4728. +{
  4729. +  FILE *file = (FILE *)afile;
  4730. +  
  4731. +  switch (how) {
  4732. +  case bfd_print_symbol_name:
  4733. +    fprintf(file, "%s", symbol->name);
  4734. +    break;
  4735. +  case bfd_print_symbol_more:
  4736. +    fprintf(stderr,"%4x %2x %2x",
  4737. +        (unsigned int)((amiga_symbol(symbol)->hunk_number)&0xffff),0,
  4738. +        amiga_symbol(symbol)->type);
  4739. +    break;
  4740. +  case bfd_print_symbol_all:
  4741. +      {
  4742. +    CONST char *section_name = symbol->section->name;
  4743. +    if (symbol->name[0] == ' ')
  4744. +      {
  4745. +        fprintf(file, "* empty table entry ");
  4746. +      }
  4747. +    else
  4748. +      {
  4749. +        bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
  4750. +
  4751. +        fprintf(file," %-5s %04x %02x %s",
  4752. +            section_name,
  4753. +            (unsigned int)((amiga_symbol(symbol)->hunk_number)&0xffff),
  4754. +            (unsigned) 0,                       /* ->other */
  4755. +            symbol->name);                      /* ->name */
  4756. +    }
  4757. +      }
  4758. +    break;
  4759. +  }
  4760. +}
  4761. +
  4762. + long
  4763. +amiga_get_reloc_upper_bound (abfd, asect)
  4764. +     bfd *abfd;
  4765. +     sec_ptr asect;
  4766. +{
  4767. +  if (bfd_get_format (abfd) != bfd_object)
  4768. +    {
  4769. +      bfd_set_error(bfd_error_invalid_operation);
  4770. +      return 0;
  4771. +    }
  4772. +  return sizeof (arelent *) * (asect->reloc_count + 1);
  4773. +}
  4774. +
  4775. +
  4776. +static bfd_boolean
  4777. +read_raw_relocs (abfd, section, d_offset, count)
  4778. +    bfd *abfd;
  4779. +    sec_ptr section;
  4780. +    unsigned long d_offset;    /* offset in the bfd */
  4781. +    unsigned long count;    /* number of relocs */
  4782. +{
  4783. +  unsigned long type, no ,offset, hunk_number, j;
  4784. +  int index,br;
  4785. +
  4786. +  if (bfd_seek (abfd, d_offset, SEEK_SET))
  4787. +    return FALSE;
  4788. +  while (count > 0) 
  4789. +    {
  4790. +      /* first determine type of reloc */
  4791. +      if (!get_long (abfd, &type))
  4792. +    return FALSE;
  4793. +
  4794. +      switch (type)
  4795. +    {
  4796. +    case HUNK_RELOC32: /* 32 bit ref */
  4797. +    case HUNK_RELOC16: /* 16 bit ref */
  4798. +    case HUNK_RELOC8: /* 8 bit ref */
  4799. +    case HUNK_DREL32: /* 32 bit ref baserel */
  4800. +    case HUNK_DREL16: /* 16 bit baserel */
  4801. +    case HUNK_DREL8: /* 8 bit baserel */
  4802. +      if (type < HUNK_DREL32)
  4803. +        { /*0:8bit, 1: 16bit, 2:32bit */
  4804. +          index=2-(type-HUNK_RELOC32);
  4805. +          br=0; /* not base relative */
  4806. +        }
  4807. +      else
  4808. +        {
  4809. +          index=2-(type-HUNK_DREL32);
  4810. +          br=1; /* base relative */
  4811. +        }
  4812. +
  4813. +      if (!get_long (abfd, &no))
  4814. +        return FALSE;
  4815. +      while (no) /* read offsets and hunk number */
  4816. +        {
  4817. +          if (!get_long (abfd, &hunk_number))
  4818. +        return FALSE;
  4819. +          for (j=0; j<no; j++)
  4820. +        { /* add relocs */
  4821. +          if (!get_long (abfd, &offset) ||
  4822. +              !amiga_add_reloc (abfd, section, offset, NULL,
  4823. +                       amiga_howto_array[br][index],hunk_number))
  4824. +            return FALSE;
  4825. +        }
  4826. +          count -= no;
  4827. +          if (!get_long (abfd, &no))
  4828. +        return FALSE;
  4829. +        }
  4830. +      break;
  4831. +
  4832. +    default: /* error */
  4833. +      bfd_set_error (bfd_error_wrong_format);
  4834. +      return FALSE;
  4835. +      break;
  4836. +    }
  4837. +    }
  4838. +
  4839. +}
  4840. +
  4841. +
  4842. +/* slurp in relocs , amiga_digest_file left various pointers for us*/
  4843. +static bfd_boolean 
  4844. +amiga_slurp_relocs (abfd, section, symbols)
  4845. +     bfd *abfd;
  4846. +     sec_ptr section;
  4847. +     asymbol **symbols;
  4848. +{
  4849. +  amiga_data_type *amiga_data=AMIGA_DATA(abfd);
  4850. +  struct amiga_raw_symbol *sp;
  4851. +  amiga_symbol_type *asp;
  4852. +  long *lp;
  4853. +  unsigned long type, offset, hunk_number, no;
  4854. +  int i,n,br,j;
  4855. +  int index;
  4856. +  long count;
  4857. +  amiga_per_section_type *asect = amiga_per_section(section);
  4858. +
  4859. +  if (section->relocation)
  4860. +    return TRUE;
  4861. +
  4862. +  if (asect->raw_relocs8)
  4863. +    if (!read_raw_relocs (abfd, section, asect->raw_relocs8,
  4864. +              asect->num_raw_relocs8))
  4865. +      return FALSE;
  4866. +
  4867. +  if (asect->raw_relocs16)
  4868. +    if (!read_raw_relocs (abfd, section, asect->raw_relocs16,
  4869. +              asect->num_raw_relocs16))
  4870. +      return FALSE;
  4871. +
  4872. +  if (asect->raw_relocs32)
  4873. +    if (!read_raw_relocs (abfd, section, asect->raw_relocs32,
  4874. +              asect->num_raw_relocs32))
  4875. +      return FALSE;
  4876. +
  4877. +  /* Now step through the raw_symbols and add all relocs in them */
  4878. +  if (!amiga_data->symbols && !amiga_slurp_symbol_table (abfd))
  4879. +    return FALSE;
  4880. +
  4881. +  if (amiga_per_section(section)->hunk_ext_pos == 0)
  4882. +    return TRUE;
  4883. +
  4884. +  if (bfd_seek (abfd, amiga_per_section(section)->hunk_ext_pos, SEEK_SET))
  4885. +    return FALSE;
  4886. +
  4887. +  asp = amiga_per_section(section)->amiga_symbols;
  4888. +  while (get_long (abfd, &n) && n!=0)
  4889. +    {
  4890. +      type = (n>>24) & 0xff;
  4891. +      n &= 0xffffff;
  4892. +
  4893. +      /* skip the name */
  4894. +      if (bfd_seek (abfd, n<<2, SEEK_CUR))
  4895. +    return FALSE;
  4896. +
  4897. +      switch (type)
  4898. +    {
  4899. +    case EXT_SYMB:
  4900. +    case EXT_DEF:
  4901. +    case EXT_ABS: /* no relocs here */
  4902. +      if (bfd_seek (abfd, sizeof (long), SEEK_CUR))
  4903. +        return FALSE;
  4904. +      break;
  4905. +      /* same as below, but advance lp by one to skip common size */
  4906. +    case EXT_COMMON:
  4907. +      if (bfd_seek (abfd, sizeof (long), SEEK_CUR))
  4908. +        return FALSE;
  4909. +      /* Fall through */
  4910. +    default: /* reference to something */
  4911. +      /* points to num of refs to hunk */
  4912. +      if (!get_long (abfd, &n))
  4913. +        return FALSE;
  4914. +
  4915. +      /* Add relocs to this section, relative to asp */
  4916. +      /* determine howto first */
  4917. +      if (type==EXT_COMMON) /* 32 bit ref */
  4918. +        {
  4919. +          index=2;
  4920. +          br=0;
  4921. +        }
  4922. +      else
  4923. +        {
  4924. +          if (type>EXT_REF32)
  4925. +        type--; /* skip EXT_COMMON gap */
  4926. +             
  4927. +          type-=EXT_REF32;
  4928. +          br=0;
  4929. +
  4930. +          if (type>2) /* base relative */
  4931. +        {
  4932. +          type-=3;
  4933. +          br=1;
  4934. +        }
  4935. +          index=2-type;
  4936. +        }/* of else */
  4937. +
  4938. +      for (i=0;i<n;i++) /* refs follow */
  4939. +        {
  4940. +          if (!get_long (abfd, &offset))
  4941. +        return FALSE;
  4942. +          if (!amiga_add_reloc (abfd, section, offset, abfd->outsymbols ?
  4943. +                    (amiga_symbol_type*)abfd->outsymbols[asp->index]: asp,
  4944. +                    amiga_howto_array[br][index],-4))
  4945. +        return FALSE;
  4946. +        }
  4947. +          
  4948. +      break;
  4949. +    }/* of switch */
  4950. +      asp++;
  4951. +    }
  4952. +
  4953. +  return TRUE;
  4954. +
  4955. +}/* Of slurp_relocs */
  4956. +
  4957. +
  4958. +long
  4959. +amiga_canonicalize_reloc (abfd, section, relptr, symbols)
  4960. +     bfd *abfd;
  4961. +     sec_ptr section;
  4962. +     arelent **relptr;
  4963. +     asymbol **symbols;
  4964. +{
  4965. +  amiga_reloc_type *src;
  4966. +  int i=0;
  4967. +
  4968. +  if (!section->relocation && !amiga_slurp_relocs (abfd, section, symbols))
  4969. +    return -1;
  4970. +
  4971. +  src = (amiga_reloc_type *)section->relocation;
  4972. +  while (src != (amiga_reloc_type *) 0)
  4973. +    {
  4974. +      *relptr++ = &src->relent;
  4975. +      src = src->next;
  4976. +    }
  4977. +  *relptr = (arelent *) 0;
  4978. +
  4979. +  return section->reloc_count;
  4980. +}
  4981. +
  4982. +
  4983. +/* Set section contents */
  4984. +/* We do it the following way: 
  4985. +   if this is a bss section ==> error
  4986. +   otherwise, we try to allocate space for this section,
  4987. +   if  this has not already been done
  4988. +   Then we set the memory area to the contents */
  4989. +static bfd_boolean
  4990. +amiga_set_section_contents (abfd, section, location, offset, count)
  4991. +     bfd *abfd;
  4992. +     sec_ptr section;
  4993. +     unsigned char *location;
  4994. +     file_ptr offset;
  4995. +     int count;
  4996. +{
  4997. +  unsigned char *contents;
  4998. +
  4999. +  if ((section->flags&SEC_HAS_CONTENTS)==0) /* BSS */
  5000. +    {
  5001. +      bfd_set_error(bfd_error_invalid_operation);
  5002. +      return FALSE;
  5003. +    }
  5004. +  
  5005. +  if ((section->flags&SEC_IN_MEMORY)==0) /* Not in memory, so alloc space */
  5006. +    {
  5007. +      contents=bfd_zalloc(abfd,section->_raw_size);
  5008. +      if (!contents)
  5009. +    {
  5010. +      bfd_set_error(bfd_error_no_memory);
  5011. +      return FALSE;
  5012. +    }
  5013. +      
  5014. +      DPRINT(5,("Allocated %lx bytes at %lx\n",section->_raw_size,contents));
  5015. +
  5016. +      section->contents=contents;
  5017. +      section->flags|=SEC_IN_MEMORY;
  5018. +    }
  5019. +  else /* In memory */
  5020. +    contents=section->contents;
  5021. +
  5022. +  /* Copy mem */
  5023. +  memmove(contents+offset,location,count);
  5024. +
  5025. +  return(TRUE);
  5026. +
  5027. +}/* Of section_set_contents */
  5028. +
  5029. +
  5030. +/* FIXME: Is this everything ? */
  5031. +static bfd_boolean
  5032. +amiga_set_arch_mach (abfd, arch, machine)
  5033. +     bfd *abfd;
  5034. +     enum bfd_architecture arch;
  5035. +     unsigned long machine;
  5036. +{
  5037. +  bfd_default_set_arch_mach(abfd, arch, machine);
  5038. +
  5039. +  if (arch == bfd_arch_m68k)
  5040. +    {
  5041. +      switch (machine)
  5042. +    {
  5043. +    case 68000:
  5044. +    case 68008:
  5045. +    case 68010:
  5046. +    case 68020:
  5047. +    case 68030:
  5048. +    case 68040:
  5049. +    case 68070:
  5050. +    case 0:
  5051. +      return TRUE;
  5052. +    default:
  5053. +      return FALSE;
  5054. +    }
  5055. +    }
  5056. +  else if (arch == bfd_arch_powerpc)
  5057. +    {
  5058. +      return TRUE;
  5059. +    }
  5060. +  return FALSE;
  5061. +}
  5062. +
  5063. +static int
  5064. +DEFUN(amiga_sizeof_headers,(ignore_abfd, ignore),
  5065. +      bfd *ignore_abfd AND
  5066. +      bfd_boolean ignore)
  5067. +{
  5068. +  /* The amiga hunk format doesn't have headers.*/
  5069. +  return 0;
  5070. +}
  5071. +
  5072. +/* Provided a BFD, a section and an offset into the section, calculate
  5073. +   and return the name of the source file and the line nearest to the
  5074. +   wanted location.  */
  5075. +bfd_boolean
  5076. +amiga_find_nearest_line(abfd, section, symbols, offset, filename_ptr,
  5077. +            functionname_ptr, line_ptr)
  5078. +     bfd *abfd;
  5079. +     asection *section;
  5080. +     asymbol **symbols;
  5081. +     bfd_vma offset;
  5082. +     char **filename_ptr;
  5083. +     char **functionname_ptr;
  5084. +     int *line_ptr;
  5085. +{
  5086. +  /* FIXME (see aoutx.h, for example) */
  5087. +  return FALSE;
  5088. +}
  5089. +
  5090. +static const struct reloc_howto_struct *
  5091. +amiga_bfd_reloc_type_lookup (abfd, code)
  5092. +       bfd *abfd;
  5093. +       bfd_reloc_code_real_type code;
  5094. +{
  5095. +  switch (code)
  5096. +    {
  5097. +    case BFD_RELOC_8_PCREL:  return &howto_hunk_reloc8;
  5098. +    case BFD_RELOC_16_PCREL: return &howto_hunk_reloc16;
  5099. +    case BFD_RELOC_CTOR:
  5100. +    case BFD_RELOC_32_PCREL: return &howto_hunk_reloc32;
  5101. +    case BFD_RELOC_8:        return &howto_hunk_reloc8;
  5102. +    case BFD_RELOC_16:       return &howto_hunk_reloc16;
  5103. +    case BFD_RELOC_32:       return &howto_hunk_reloc32;
  5104. +      /* FIXME: Add more cases here for base relative relocs*/
  5105. +    default:                 return 0;
  5106. +    }
  5107. +}
  5108. +
  5109. +static bfd_boolean
  5110. +amiga_bfd_copy_private_bfd_data (ibfd, obfd)
  5111. +     bfd *ibfd;
  5112. +     bfd *obfd;
  5113. +{
  5114. +  AMIGA_DATA(obfd)->IsLoadFile = AMIGA_DATA(ibfd)->IsLoadFile;
  5115. +  return TRUE;
  5116. +}
  5117. +
  5118. +static bfd_boolean
  5119. +amiga_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
  5120. +     bfd *ibfd;
  5121. +     asection *isec;
  5122. +     bfd *obfd;
  5123. +     asection *osec;
  5124. +{
  5125. +  if (bfd_get_flavour (osec->owner) == bfd_target_amiga_flavour) {
  5126. +    amiga_per_section (osec)->disk_size = amiga_per_section (isec)->disk_size;
  5127. +    amiga_per_section (osec)->attribute = amiga_per_section (isec)->attribute;
  5128. +  }
  5129. +  return TRUE;
  5130. +}
  5131. +
  5132. +/* There is no armap in the amiga libraries, so we fill carsym entries
  5133. +   one by one after having parsed the whole archive. */
  5134. +static bfd_boolean
  5135. +amiga_slurp_armap (abfd)
  5136. +     bfd *abfd;
  5137. +{
  5138. +  unsigned long type, n, slen;
  5139. +  struct arch_syms *syms;
  5140. +  unsigned long symcount=0;
  5141. +  carsym *defsyms, *csym;
  5142. +  unsigned long *symblock,len;
  5143. +
  5144. +  /* allocate the carsyms */
  5145. +  syms = amiga_ardata(abfd)->defsyms;
  5146. +  symcount = amiga_ardata(abfd)->defsym_count;
  5147. +
  5148. +  defsyms = (carsym*) bfd_alloc (abfd, sizeof (carsym) * symcount);
  5149. +  if (!defsyms)
  5150. +    return FALSE;
  5151. +
  5152. +  bfd_ardata(abfd)->symdefs = defsyms;
  5153. +  bfd_ardata(abfd)->symdef_count = symcount;
  5154. +
  5155. +  csym = defsyms;
  5156. +  while (syms) {
  5157. +    if (bfd_seek (abfd, syms->offset, SEEK_SET))
  5158. +      return FALSE;
  5159. +    symblock = (unsigned long*) bfd_alloc (abfd, syms->size);
  5160. +    if (!symblock)
  5161. +      return FALSE;
  5162. +    if (bfd_bread (symblock, syms->size, abfd) != syms->size)
  5163. +      return FALSE;
  5164. +    while ((n=GL(symblock)) != 0)
  5165. +      {
  5166. +    symblock++;
  5167. +    len = n & 0xffffff;
  5168. +    type = (n>>24) & 0xff;
  5169. +    switch (type) {
  5170. +    case EXT_SYMB:
  5171. +    case EXT_DEF:
  5172. +    case EXT_ABS:
  5173. +      slen = len<<2;
  5174. +      csym->name = (char*)symblock;
  5175. +      if (*((char*)symblock+slen-1) != '\0')
  5176. +        *((char*)symblock+slen) = '\0';
  5177. +      csym->file_offset = syms->unit_offset;
  5178. +      csym++;
  5179. +      symblock += len+1;    /* name+value */
  5180. +      break;
  5181. +    case EXT_REF8:
  5182. +    case EXT_REF16:
  5183. +    case EXT_REF32:
  5184. +    case EXT_DEXT8:
  5185. +    case EXT_DEXT16:
  5186. +    case EXT_DEXT32:
  5187. +      symblock += len;
  5188. +      symblock += 1+GL(symblock);
  5189. +      break;
  5190. +    case EXT_COMMON:
  5191. +      symblock += len+1;
  5192. +      symblock += 1+GL(symblock);
  5193. +      break;
  5194. +    default: /* error */
  5195. +      fprintf (stderr, "unexpected type in hunk_ext\n");
  5196. +      return FALSE;
  5197. +    }
  5198. +      }
  5199. +    syms = syms->next;
  5200. +  }
  5201. +  bfd_has_map (abfd) = TRUE;
  5202. +  return TRUE;
  5203. +}
  5204. +
  5205. +static void amiga_truncate_arname ()
  5206. +{
  5207. +}
  5208. +
  5209. +static const struct bfd_target *
  5210. +amiga_archive_p (abfd)
  5211. +     bfd *abfd;
  5212. +{
  5213. +  long header;
  5214. +  struct stat stat_buffer;
  5215. +  int units;
  5216. +  symindex symcount = 0;
  5217. +  struct arch_syms *symbols = NULL;
  5218. +
  5219. +  bfd_set_error (bfd_error_wrong_format);
  5220. +
  5221. +  if (bfd_stat (abfd, &stat_buffer) < 0)
  5222. +    return FALSE;
  5223. +
  5224. +  if (stat_buffer.st_size != 0)
  5225. +    {
  5226. +      /* scan the units */
  5227. +      if (!parse_archive_units (abfd, &units, stat_buffer.st_size, FALSE,
  5228. +                &symbols, &symcount))
  5229. +    return NULL;
  5230. +
  5231. +      /* if there is only one unit, we consider it's an object, not an
  5232. +     archive. Obviously it's not always TRUE but taking objects
  5233. +     for archives makes ld fail, so we don't have much of a choice */
  5234. +      if (units == 1)
  5235. +    return NULL;
  5236. +
  5237. +    }
  5238. +
  5239. +  if (abfd->arelt_data)
  5240. +    arelt_size (abfd) = bfd_tell (abfd);
  5241. +
  5242. +  bfd_seek (abfd, 0, SEEK_SET);
  5243. +  abfd->arch_info = bfd_scan_arch ("m68k:68000");
  5244. +
  5245. +  if (amiga_mkarchive (abfd))
  5246. +    {
  5247. +      amiga_ardata(abfd)->filesize = stat_buffer.st_size;
  5248. +      bfd_ardata(abfd)->first_file_filepos = 0;
  5249. +      amiga_ardata(abfd)->defsym_count = symcount;
  5250. +      amiga_ardata(abfd)->defsyms = symbols;
  5251. +      if (amiga_slurp_armap (abfd))
  5252. +    return abfd->xvec;
  5253. +      else
  5254. +    return NULL;
  5255. +    }
  5256. +    else
  5257. +      return NULL;
  5258. +}
  5259. +
  5260. +static bfd *
  5261. +amiga_openr_next_archived_file (archive, last_file)
  5262. +     bfd *archive;
  5263. +     bfd *last_file;
  5264. +{
  5265. +  file_ptr filestart;
  5266. +
  5267. +  if (!last_file)
  5268. +    filestart = bfd_ardata(archive)->first_file_filepos;
  5269. +  else
  5270. +    {
  5271. +      unsigned int size = arelt_size (last_file);
  5272. +      /* Pad to an even boundary... */
  5273. +      filestart = last_file->origin + size;
  5274. +      filestart += filestart % 2;
  5275. +    }
  5276. +
  5277. +  return _bfd_get_elt_at_filepos (archive, filestart);
  5278. +}
  5279. +
  5280. +static PTR
  5281. +amiga_read_ar_hdr (abfd)
  5282. +   bfd *abfd;
  5283. +{
  5284. +  struct areltdata *ared;
  5285. +  char *filename = NULL;
  5286. +  unsigned long header, read, len, start_pos;
  5287. +
  5288. +  start_pos = bfd_tell (abfd);
  5289. +
  5290. +  if (start_pos >= amiga_ardata(abfd)->filesize) {
  5291. +    bfd_set_error (bfd_error_no_more_archived_files);
  5292. +    return NULL;
  5293. +  }
  5294. +
  5295. +  if (bfd_bread ((PTR) &header, sizeof (header), abfd) != sizeof (header))
  5296. +      return NULL;
  5297. +
  5298. +  if (GL(&header) != HUNK_UNIT)
  5299. +    {
  5300. +      bfd_set_error (bfd_error_malformed_archive);
  5301. +      return NULL;
  5302. +    }
  5303. +
  5304. +  /* get the unit name length in long words */
  5305. +  if (!get_long (abfd, &len))
  5306. +    return NULL;
  5307. +  len = len << 2;
  5308. +
  5309. +  ared = bfd_zalloc (abfd, sizeof (struct areltdata));
  5310. +  if (ared == NULL) {
  5311. +    bfd_set_error (bfd_error_no_memory);
  5312. +    return NULL;
  5313. +  }
  5314. +
  5315. +  if (len)
  5316. +    {
  5317. +      if (!(ared->filename =  bfd_alloc (abfd, len+1)))
  5318. +    {
  5319. +      bfd_set_error (bfd_error_no_memory);
  5320. +      return NULL;
  5321. +    }
  5322. +      else
  5323. +    {
  5324. +      if (bfd_bread (ared->filename, len, abfd) != len)
  5325. +        return NULL;
  5326. +      ared->filename[len] = '\0';
  5327. +    }
  5328. +    }
  5329. +  else
  5330. +    ared->filename = "(no name)";
  5331. +
  5332. +  if (bfd_seek (abfd, start_pos+4, SEEK_SET))
  5333. +    return FALSE;
  5334. +
  5335. +  if (!amiga_read_unit (abfd, amiga_ardata(abfd)->filesize))
  5336. +    return NULL;
  5337. +
  5338. +  ared->parsed_size = bfd_tell(abfd)-start_pos;
  5339. +  if (bfd_seek (abfd, start_pos, SEEK_SET))
  5340. +    return FALSE;
  5341. +  return (PTR) ared;
  5342. +}
  5343. +
  5344. +int
  5345. +amiga_generic_stat_arch_elt (abfd, buf)
  5346. +   bfd *abfd;
  5347. +   struct stat *buf;
  5348. +{
  5349. +  if (abfd->arelt_data == NULL)
  5350. +    {
  5351. +      bfd_set_error (bfd_error_invalid_operation);
  5352. +      return -1;
  5353. +    }
  5354. +
  5355. +  /* No header in amiga archives. Let's set reasonable default values */
  5356. +  buf->st_mtime = 0;
  5357. +  buf->st_uid = 0;
  5358. +  buf->st_gid = 0;
  5359. +  buf->st_mode = 0666;
  5360. +
  5361. +  buf->st_size = ((struct areltdata*)(abfd->arelt_data))->parsed_size;
  5362. +
  5363. +  return 0;
  5364. +}
  5365. +
  5366. +/* We don't have core files.  */
  5367. +#define    amiga_core_file_failing_command _bfd_dummy_core_file_failing_command
  5368. +#define    amiga_core_file_failing_signal _bfd_dummy_core_file_failing_signal
  5369. +#define    amiga_core_file_matches_executable_p _bfd_dummy_core_file_matches_executable_p
  5370. +
  5371. +/* Entry points through BFD_JUMP_TABLE_ARCHIVE */
  5372. +/*#define    amiga_slurp_armap        bfd_slurp_amiga_armap*/
  5373. +#define    amiga_slurp_extended_name_table    _bfd_slurp_extended_name_table
  5374. +#define amiga_construct_extended_name_table _bfd_archive_bsd_construct_extended_name_table
  5375. +/*#define    amiga_truncate_arname        bfd_gnu_truncate_arname*/
  5376. +/*#define    amiga_write_armap        amiga_write_armap*/
  5377. +/*#define    amiga_read_ar_hdr        _bfd_generic_read_ar_hdr*/
  5378. +/*#define    amiga_openr_next_archived_file    bfd_generic_openr_next_archived_file*/
  5379. +
  5380. +#define amiga_get_elt_at_index        _bfd_generic_get_elt_at_index
  5381. +/* #define amiga_generic_stat_arch_elt    bfd_generic_stat_arch_elt */
  5382. +#define amiga_update_armap_timestamp    _bfd_archive_bsd_update_armap_timestamp
  5383. +
  5384. +/* Entry points through BFD_JUMP_TABLE_SYMBOLS */
  5385. +#undef amiga_get_symtab_upper_bound    /* defined above */
  5386. +#undef amiga_get_symtab            /* defined above */
  5387. +#undef amiga_make_empty_symbol        /* defined above */
  5388. +#undef amiga_print_symbol        /* defined above */
  5389. +#undef amiga_get_symbol_info        /* defined above */
  5390. +#define amiga_bfd_is_local_label    bfd_generic_is_local_label
  5391. +#define amiga_get_lineno        (struct lineno_cache_entry *(*)())bfd_nullvoidptr
  5392. +#undef amiga_find_nearest_line        /* defined above */
  5393. +#define amiga_bfd_make_debug_symbol    (asymbol * (*)(bfd *, void *, unsigned long)) bfd_nullvoidptr
  5394. +#define amiga_read_minisymbols        _bfd_generic_read_minisymbols
  5395. +#define amiga_minisymbol_to_symbol    _bfd_generic_minisymbol_to_symbol
  5396. +
  5397. +#define amiga_bfd_debug_info_start        bfd_void
  5398. +#define amiga_bfd_debug_info_end        bfd_void
  5399. +#define amiga_bfd_debug_info_accumulate    (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
  5400. +#define amiga_bfd_is_local_label_name bfd_generic_is_local_label_name
  5401. +
  5402. +/* NOTE: We use a special get_relocated_section_contents both in amiga AND in a.out files.
  5403. +   In addition, we use an own final_link routine, which is nearly identical to _bfd_generic_final_link */
  5404. +extern bfd_byte *get_relocated_section_contents(bfd*, struct bfd_link_info *,
  5405. +                        struct bfd_link_order *, bfd_byte *,
  5406. +                        bfd_boolean, asymbol **);
  5407. +#define amiga_bfd_get_relocated_section_contents get_relocated_section_contents
  5408. +#define amiga_bfd_relax_section                   bfd_generic_relax_section
  5409. +#define amiga_bfd_gc_sections                     bfd_generic_gc_sections
  5410. +#define amiga_bfd_merge_sections              bfd_generic_merge_sections
  5411. +#define amiga_bfd_discard_group                      bfd_generic_discard_group
  5412. +
  5413. +#define amiga_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
  5414. +#define amiga_bfd_link_hash_table_free   _bfd_generic_link_hash_table_free
  5415. +#define amiga_bfd_link_add_symbols _bfd_generic_link_add_symbols
  5416. +#define amiga_bfd_link_just_syms    _bfd_generic_link_just_syms
  5417. +extern bfd_boolean amiga_final_link(bfd *, struct bfd_link_info *);
  5418. +#define amiga_bfd_final_link amiga_final_link
  5419. +
  5420. +/* Entry points through BFD_JUMP_TABLE_GENERIC */
  5421. +#define amiga_close_and_cleanup         _bfd_generic_close_and_cleanup
  5422. +#define amiga_bfd_free_cached_info    _bfd_generic_bfd_free_cached_info
  5423. +/* amiga_new_section_hook defined above */
  5424. +/* amiga_get_section_hook defined above */
  5425. +#define amiga_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
  5426. +
  5427. +/* Entry points through BFD_JUMP_TABLE_COPY */
  5428. +#define amiga_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
  5429. +/*#define amiga_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data*/
  5430. +#define amiga_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
  5431. +#define amiga_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
  5432. +#define amiga_bfd_print_private_flags _bfd_generic_bfd_print_private_flags
  5433. +#define amiga_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
  5434. +
  5435. +#define amiga_bfd_link_split_section  _bfd_generic_link_split_section
  5436. +
  5437. +#if defined (amiga)
  5438. +/* So that the JUMP_TABLE() macro below can work.  */
  5439. +#undef amiga
  5440. +#endif
  5441. +
  5442. +const bfd_target amiga_vec =
  5443. +{
  5444. +  "amiga",        /* name */
  5445. +  bfd_target_amiga_flavour,
  5446. +  TRUE,            /* data byte order is big */
  5447. +  TRUE,            /* header byte order is big */
  5448. +  HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT, /* object flags */
  5449. + /* section flags */
  5450. +  SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA,
  5451. +  '_',                /* symbol leading char */
  5452. +  ' ',                /* ar_pad_char */
  5453. +  15,                /* ar_max_namelen */    /* (15 for UNIX compatibility) */
  5454. +  bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32,
  5455. +  bfd_putb32, bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
  5456. +  bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32,
  5457. +  bfd_putb32, bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
  5458. +  {
  5459. +    /* bfd_check_format */
  5460. +    _bfd_dummy_target,
  5461. +    amiga_object_p,
  5462. +    amiga_archive_p,
  5463. +    _bfd_dummy_target
  5464. +  },
  5465. +  {
  5466. +    /* bfd_set_format */
  5467. +    bfd_false,
  5468. +    amiga_mkobject,
  5469. +    amiga_mkarchive,
  5470. +    bfd_false
  5471. +  },
  5472. +  {
  5473. +    /* bfd_write_contents */
  5474. +    bfd_false,
  5475. +    amiga_write_object_contents,
  5476. +    amiga_write_archive_contents,
  5477. +    bfd_false
  5478. +  },
  5479. +  BFD_JUMP_TABLE_GENERIC (amiga),
  5480. +  BFD_JUMP_TABLE_COPY (amiga),
  5481. +  BFD_JUMP_TABLE_CORE (_bfd_nocore),
  5482. +  BFD_JUMP_TABLE_ARCHIVE (amiga),
  5483. +  BFD_JUMP_TABLE_SYMBOLS (amiga),
  5484. +  BFD_JUMP_TABLE_RELOCS (amiga),
  5485. +  BFD_JUMP_TABLE_WRITE (amiga),
  5486. +  BFD_JUMP_TABLE_LINK (amiga),
  5487. +  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  5488. +  (PTR) 0
  5489. +#if 0
  5490. +/* fixme: no longer in use?  */
  5491. +  /* How applications can find out about amiga relocation types (see
  5492. +     documentation on reloc types).  */
  5493. +  amiga_reloc_type_lookup
  5494. +#endif
  5495. +};
  5496. diff -urNEBb binutils-2.14-orig/bfd/amigaoslink.c binutils-2.14/bfd/amigaoslink.c
  5497. --- binutils-2.14-orig/bfd/amigaoslink.c    1970-01-01 01:00:00.000000000 +0100
  5498. +++ binutils-2.14/bfd/amigaoslink.c    2003-12-02 14:09:39.000000000 +0100
  5499. @@ -0,0 +1,1190 @@
  5500. +/* BFD back-end for Commodore-Amiga AmigaOS binaries. Linker routines.
  5501. +   Copyright (C) 1990-1994 Free Software Foundation, Inc.
  5502. +   Contributed by Stephan Thesing
  5503. +
  5504. +This file is part of BFD, the Binary File Descriptor library.
  5505. +
  5506. +This program is free software; you can redistribute it and/or modify
  5507. +it under the terms of the GNU General Public License as published by
  5508. +the Free Software Foundation; either version 2 of the License, or
  5509. +(at your option) any later version.
  5510. +
  5511. +This program is distributed in the hope that it will be useful,
  5512. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  5513. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5514. +GNU General Public License for more details.
  5515. +
  5516. +You should have received a copy of the GNU General Public License
  5517. +along with this program; if not, write to the Free Software
  5518. +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  5519. +
  5520. +/*
  5521. +INODE
  5522. +amigalink, , implementation, amiga
  5523. +SECTION
  5524. +    amigalink
  5525. +
  5526. +This is the description of the linker routines for the amiga.
  5527. +In fact, this includes a description of the changes made to the
  5528. +a.out code, in order to build a working linker for the Amiga.
  5529. +@menu
  5530. +@* alterations::
  5531. +@end menu
  5532. +
  5533. +INODE 
  5534. +alterations, , , amigalink
  5535. +SUBSECTION
  5536. +    alterations
  5537. +
  5538. +The file @file{aout-amiga.c} defines the amiga a.out backend. It differs from
  5539. +the sun3 backend only in these details:
  5540. +    o The @code{final_link} routine is @code{amiga_final_link}.
  5541. +    o The routine to get the relocated section contents is
  5542. +           @code{aout_bfd_get_relocated_section_contents}.
  5543. +
  5544. +This ensures that the link is performed properly, but has the side effect of loosing
  5545. +performance.
  5546. +
  5547. +
  5548. +The amiga bfd code uses the same @code{amiga_final_link} routine, but with a 
  5549. +different <<get_relocated_section_contents>> entry: <<amiga_bfd_get_relocated_section_contents>>.
  5550. +The latter  differs from the routine of the a.out backend only in the application of relocs
  5551. + to the section contents.
  5552. +@@*
  5553. +
  5554. +The usage of a special linker code has one reason:
  5555. +The bfd library assumes that a program is always loaded at a known memory
  5556. +address. This is not a case on an Amiga. So the Amiga format has to take over
  5557. +some relocs to an executable output file. 
  5558. +This is not the case with a.out formats, so there relocations can be applied at link time,
  5559. +not at run time, like on the Amiga.
  5560. +The special routines compensate this: instead of applying the relocations, they are
  5561. +copied to the output file, if neccessary.
  5562. +As as consequence, the @code{final_link} and @code{get_relocated_section_contents} are nearly identical to
  5563. +the original routines from @file{linker.c} and @file{reloc.c}.
  5564. +*/
  5565. +
  5566. +#include "bfd.h"
  5567. +#include "bfdlink.h"
  5568. +#include "sysdep.h"
  5569. +#include "genlink.h"
  5570. +#include "libbfd.h"
  5571. +
  5572. +#include "libamiga.h"
  5573. +#undef GET_SWORD
  5574. +#define aadata ((bfd)->tdata.amiga_data->a)
  5575. +#undef adata
  5576. +#include "libaout.h"
  5577. +
  5578. +
  5579. +#define max(x,y) (((x)<=(y))?(y):(x))
  5580. +
  5581. +#define DEBUG_AMIGA 10000
  5582. +
  5583. +#if DEBUG_AMIGA
  5584. +#include <stdarg.h>
  5585. +static void
  5586. +error_print(const char *fmt,...)
  5587. +{
  5588. +  va_list args;
  5589. +
  5590. +  va_start (args, fmt);
  5591. +  vfprintf (stderr, fmt, args);
  5592. +  va_end (args);
  5593. +}
  5594. +
  5595. +#define DPRINT(L,x) if (L>=DEBUG_AMIGA) error_print x
  5596. +#else
  5597. +#define DPRINT(L,x) 
  5598. +#endif
  5599. +
  5600. +/* This one is used by the linker and tells us, if a debug hunk should be
  5601. +   written out*/
  5602. +int write_debug_hunk = 0;
  5603. +
  5604. +/* This is also used by the linker to set the attribute of sections */
  5605. +int amiga_attribute = 0;
  5606. +
  5607. +/* This one is used to indicate base-relative linking */
  5608. +int amiga_base_relative=0;
  5609. +
  5610. +/* This one is used to indicate -resident linking */
  5611. +int amiga_resident=0;
  5612. +
  5613. +/* generate a pOS executable */
  5614. +int amiga_pOS_flg;
  5615. +
  5616. +extern bfd_boolean default_indirect_link_order
  5617. +  PARAMS ((bfd *, struct bfd_link_info *, asection *,
  5618. +       struct bfd_link_order *, bfd_boolean));
  5619. +
  5620. +
  5621. +
  5622. +bfd_byte *
  5623. +get_relocated_section_contents PARAMS((bfd *, struct bfd_link_info *,
  5624. +                       struct bfd_link_order *, bfd_byte *,
  5625. +                       bfd_boolean , asymbol **));
  5626. +static bfd_reloc_status_type
  5627. +amiga_perform_reloc PARAMS((bfd *, arelent *, PTR, asection *, bfd *, char **));
  5628. +static bfd_reloc_status_type 
  5629. +aout_perform_reloc PARAMS ((bfd *, arelent *, PTR, asection *, bfd *, char **));
  5630. +static bfd_boolean
  5631. +amiga_reloc_link_order PARAMS ((bfd *, struct bfd_link_info *,asection *,
  5632. +                struct bfd_link_order *));
  5633. +
  5634. +
  5635. +/* This one is nearly identical to bfd_generic_get_relocated_section_contents
  5636. +   from reloc.c */
  5637. +bfd_byte *
  5638. +get_relocated_section_contents (abfd, link_info, link_order, data,
  5639. +                        relocateable, symbols)
  5640. +     bfd *abfd;
  5641. +     struct bfd_link_info *link_info;
  5642. +     struct bfd_link_order *link_order;
  5643. +     bfd_byte *data;
  5644. +     bfd_boolean relocateable;
  5645. +     asymbol **symbols;
  5646. +{
  5647. +  bfd *input_bfd = link_order->u.indirect.section->owner;
  5648. +  asection *input_section = link_order->u.indirect.section;
  5649. +
  5650. +  long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
  5651. +  arelent **reloc_vector = NULL;
  5652. +  long reloc_count;
  5653. +  bfd_reloc_status_type (*reloc_func)(bfd *, arelent *, PTR, asection *,
  5654. +                      bfd *, char **);
  5655. +
  5656. +  DPRINT(5,("Entering get_rel_sec_cont\n"));
  5657. +
  5658. +  if (reloc_size < 0)
  5659. +    goto error_return;
  5660. +
  5661. +  if (input_bfd->xvec->flavour==bfd_target_amiga_flavour)
  5662. +    reloc_func=amiga_perform_reloc;
  5663. +  else if (input_bfd->xvec->flavour==bfd_target_aout_flavour)
  5664. +    reloc_func=aout_perform_reloc;
  5665. +  else
  5666. +    {
  5667. +      bfd_set_error(bfd_error_bad_value);
  5668. +      goto error_return;
  5669. +    }
  5670. +
  5671. +  reloc_vector = (arelent **) malloc (reloc_size);
  5672. +
  5673. +  if (reloc_vector == NULL && reloc_size != 0)
  5674. +    {
  5675. +      bfd_set_error (bfd_error_no_memory);
  5676. +      goto error_return;
  5677. +    }
  5678. +
  5679. +  DPRINT(5,("GRSC: GetSecCont()\n"));
  5680. +  /* read in the section */
  5681. +  if (!bfd_get_section_contents (input_bfd,
  5682. +                 input_section,
  5683. +                 (PTR) data,
  5684. +                 0,
  5685. +                 input_section->_raw_size))
  5686. +    goto error_return;
  5687. +
  5688. +  /* We're not relaxing the section, so just copy the size info */
  5689. +  input_section->_cooked_size = input_section->_raw_size;
  5690. +  input_section->reloc_done = TRUE;
  5691. +
  5692. +  DPRINT(5,("GRSC: CanReloc\n"));
  5693. +  reloc_count = bfd_canonicalize_reloc (input_bfd,
  5694. +                    input_section,
  5695. +                    reloc_vector,
  5696. +                    symbols);
  5697. +  if (reloc_count < 0)
  5698. +    goto error_return;
  5699. +
  5700. +  if (reloc_count > 0)
  5701. +    {
  5702. +      arelent **parent;
  5703. +
  5704. +      DPRINT(5,("reloc_count=%d\n",reloc_count));
  5705. +
  5706. +      for (parent = reloc_vector; *parent != (arelent *) NULL;
  5707. +       parent++)
  5708. +    {
  5709. +      char *error_message = (char *) NULL;
  5710. +      bfd_reloc_status_type r ;
  5711. +
  5712. +      DPRINT(5,("Applying a reloc\nparent=%lx, reloc_vector=%lx,"
  5713. +            "*parent=%lx\n",parent,reloc_vector,*parent));
  5714. +      r=(*reloc_func) (input_bfd,
  5715. +               *parent,
  5716. +               (PTR) data,
  5717. +               input_section,
  5718. +               relocateable ? abfd : (bfd *) NULL,
  5719. +               &error_message);
  5720. +      if (relocateable)
  5721. +        {
  5722. +          asection *os = input_section->output_section;
  5723. +
  5724. +          DPRINT(5,("Keeping reloc\n"));
  5725. +          /* A partial link, so keep the relocs */
  5726. +          os->orelocation[os->reloc_count] = *parent;
  5727. +          os->reloc_count++;
  5728. +        }
  5729. +
  5730. +      if (r != bfd_reloc_ok)
  5731. +        {
  5732. +          switch (r)
  5733. +        {
  5734. +        case bfd_reloc_undefined:
  5735. +          if (!((*link_info->callbacks->undefined_symbol)
  5736. +            (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
  5737. +             input_bfd, input_section, (*parent)->address, TRUE)))
  5738. +            goto error_return;
  5739. +          break;
  5740. +        case bfd_reloc_dangerous:
  5741. +          BFD_ASSERT (error_message != (char *) NULL);
  5742. +          if (!((*link_info->callbacks->reloc_dangerous)
  5743. +            (link_info, error_message, input_bfd, input_section,
  5744. +             (*parent)->address)))
  5745. +            goto error_return;
  5746. +          break;
  5747. +        case bfd_reloc_overflow:
  5748. +          if (!((*link_info->callbacks->reloc_overflow)
  5749. +            (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
  5750. +             (*parent)->howto->name, (*parent)->addend,
  5751. +             input_bfd, input_section, (*parent)->address)))
  5752. +            goto error_return;
  5753. +          break;
  5754. +        case bfd_reloc_outofrange:
  5755. +        default:
  5756. +          DPRINT(10,("get_rel_sec_cont fails, perform reloc "
  5757. +                 "returned $%x\n",r));
  5758. +          abort ();
  5759. +          break;
  5760. +        }
  5761. +
  5762. +        }
  5763. +    }
  5764. +    }
  5765. +  if (reloc_vector != NULL)
  5766. +    free (reloc_vector);
  5767. +  DPRINT(5,("GRSC: Returning ok\n"));
  5768. +  return data;
  5769. +
  5770. +error_return:
  5771. +  DPRINT(5,("GRSC: Error_return\n"));
  5772. +  if (reloc_vector != NULL)
  5773. +    free (reloc_vector);
  5774. +  return NULL;
  5775. +}
  5776. +
  5777. +
  5778. +/* Add a value to a location */
  5779. +static bfd_reloc_status_type
  5780. +my_add_to (data, offset, size, add, sign)
  5781. +  PTR data;
  5782. +  int offset, size, add, sign;
  5783. +{
  5784. +  signed char *p;
  5785. +  int val;
  5786. +  bfd_reloc_status_type ret;
  5787. +
  5788. +  DPRINT(5,("Entering add_value\n"));
  5789. +
  5790. +  ret=bfd_reloc_ok;
  5791. +  p=((signed char*)data)+offset;
  5792. +
  5793. +  switch (size)
  5794. +    {
  5795. +    case 0: /* byte size */
  5796. +      val = (int)(p[0]) + add;
  5797. +      /* check for overflow */
  5798. +      if (sign) {
  5799. +    if (val<-0x80 || val>0x7f)
  5800. +      ret = bfd_reloc_overflow;
  5801. +      }
  5802. +      else {
  5803. +    if ((val&0xffffff00)!=0 && (val&0xffffff00)!=0xffffff00)
  5804. +      ret=bfd_reloc_overflow;
  5805. +      }
  5806. +      /* set the value */
  5807. +      p[0]=val&0xff;
  5808. +      break;
  5809. +
  5810. +    case 1: /* word size */
  5811. +      val = (int)((p[1]&0xff)|(p[0]<<8)) + add;
  5812. +      /* check for overflow */
  5813. +      if (sign) {
  5814. +    if (val<-0x8000 || val>0x7fff)
  5815. +      ret = bfd_reloc_overflow;
  5816. +      }
  5817. +      else {
  5818. +    if ((val&0xffff0000)!=0 && (val&0xffff0000)!=0xffff0000)
  5819. +      ret=bfd_reloc_overflow;
  5820. +      }
  5821. +      /* set the value */
  5822. +      p[1]=val&0xff;
  5823. +      p[0]=((val&0xff00)>>8)&0xff;
  5824. +      break;
  5825. +
  5826. +    case 2: /* long word */
  5827. +      val = bfd_getb_signed_32 (p) + add;
  5828. +      /* If we are linking a resident program, then we limit the reloc size
  5829. +         to about +/- 1 GB.
  5830. +         
  5831. +         When linking a shared library all variables defined in other
  5832. +         libraries are placed in memory >0x80000000, so if the library
  5833. +         tries to use one of those variables an error is output.
  5834. +         
  5835. +         Without this it would be much more difficult to check for
  5836. +         incorrect references.
  5837. +       */
  5838. +      if (amiga_resident &&
  5839. +          (val & 0xc0000000)!=0 && (val&0xc0000000)!=0xc0000000) /* Overflow */
  5840. +    {
  5841. +      ret=bfd_reloc_overflow;
  5842. +    }
  5843. +      bfd_putb32 (val, p);
  5844. +      break;
  5845. +      
  5846. +    default: /* Error */
  5847. +      ret=bfd_reloc_notsupported;
  5848. +      break;
  5849. +    }/* Of switch */
  5850. +
  5851. +  DPRINT(5,("Leaving add_value\n"));
  5852. +  return (ret);
  5853. +}
  5854. +
  5855. +/* Set a value to a location */
  5856. +static bfd_reloc_status_type
  5857. +my_set_to (data, offset, size, val, sign)
  5858. +  PTR data;
  5859. +  int offset, size, val, sign;
  5860. +{
  5861. +  signed char *p;
  5862. +  bfd_reloc_status_type ret;
  5863. +
  5864. +  DPRINT(5,("Entering add_value\n"));
  5865. +
  5866. +  ret=bfd_reloc_ok;
  5867. +  p=((signed char*)data)+offset;
  5868. +
  5869. +  switch (size)
  5870. +    {
  5871. +    case 0: /* byte size */
  5872. +      /* check for overflow */
  5873. +      if (sign) {
  5874. +    if (val<-0x80 || val>0x7f)
  5875. +      ret = bfd_reloc_overflow;
  5876. +      }
  5877. +      else {
  5878. +    if ((val&0xffffff00)!=0 && (val&0xffffff00)!=0xffffff00)
  5879. +      ret=bfd_reloc_overflow;
  5880. +      }
  5881. +      /* set the value */
  5882. +      p[0]=val&0xff;
  5883. +      break;
  5884. +
  5885. +    case 1: /* word size */
  5886. +      /* check for overflow */
  5887. +      if (sign) {
  5888. +    if (val<-0x8000 || val>0x7fff)
  5889. +      ret = bfd_reloc_overflow;
  5890. +      }
  5891. +      else {
  5892. +    if ((val&0xffff0000)!=0 && (val&0xffff0000)!=0xffff0000)
  5893. +      ret=bfd_reloc_overflow;
  5894. +      }
  5895. +      /* set the value */
  5896. +      p[1]=val&0xff;
  5897. +      p[0]=((val&0xff00)>>8)&0xff;
  5898. +      break;
  5899. +
  5900. +    case 2: /* long word */
  5901. +      /* If we are linking a resident program, then we limit the reloc size
  5902. +         to about +/- 1 GB.
  5903. +         
  5904. +         When linking a shared library all variables defined in other
  5905. +         libraries are placed in memory >0x80000000, so if the library
  5906. +         tries to use one of those variables an error is output.
  5907. +         
  5908. +         Without this it would be much more difficult to check for
  5909. +         incorrect references.
  5910. +       */
  5911. +      if (amiga_resident &&
  5912. +          (val & 0xc0000000)!=0 && (val&0xc0000000)!=0xc0000000) /* Overflow */
  5913. +    {
  5914. +      ret=bfd_reloc_overflow;
  5915. +    }
  5916. +      p[3] = val & 0xff;
  5917. +      p[2] = (val >> 8) & 0xff;
  5918. +      p[1] = (val >> 16) & 0xff;
  5919. +      p[0] = (val >> 24) & 0xff;
  5920. +      break;
  5921. +      
  5922. +    default: /* Error */
  5923. +      ret=bfd_reloc_notsupported;
  5924. +      break;
  5925. +    }/* Of switch */
  5926. +
  5927. +  DPRINT(5,("Leaving set_value\n"));
  5928. +  return (ret);
  5929. +}
  5930. +
  5931. +/* Perform an Amiga relocation */
  5932. +static bfd_reloc_status_type 
  5933. +amiga_perform_reloc (abfd, r, data, sec, obfd, error_message)
  5934. +   bfd *abfd;
  5935. +   arelent *r;
  5936. +   PTR data;
  5937. +   asection *sec;
  5938. +   bfd *obfd;
  5939. +   char **error_message;
  5940. +{
  5941. +  asymbol *sym; /* Reloc is relative to sym */
  5942. +  asection *target_section; /* reloc is relative to this section */
  5943. +  int relocation;
  5944. +  bfd_boolean copy;
  5945. +  bfd_reloc_status_type ret;
  5946. +  int size = 2;
  5947. +  int sign = FALSE;
  5948. +
  5949. +  DPRINT(5,("Entering APR\nflavour is %d (aflavour=%d, aout_flavour=%d)\n",
  5950. +        sec->owner->xvec->flavour, bfd_target_amiga_flavour,
  5951. +        bfd_target_aout_flavour));
  5952. +
  5953. +  /* If obfd==NULL: Apply the reloc, if possible. */
  5954. +  /* Else: Modify it and return */
  5955. +
  5956. +  if (obfd!=NULL) /* Only modify the reloc */
  5957. +    {
  5958. +      r->address+=sec->output_offset;
  5959. +      sec->output_section->flags|=SEC_RELOC;
  5960. +      DPRINT(5,("Leaving APR, modified case \n"));
  5961. +      return bfd_reloc_ok;
  5962. +    }
  5963. +
  5964. +  /* Try to apply the reloc */
  5965. +
  5966. +  sym=*(r->sym_ptr_ptr);
  5967. +
  5968. +#if 0
  5969. +  /* FIXME */
  5970. +   if (sym->udata.p)
  5971. +     sym = ((struct generic_link_hash_entry*)sym->udata.p)->sym;
  5972. +#endif
  5973. +
  5974. +  target_section=sym->section;
  5975. +
  5976. +  if (target_section==bfd_und_section_ptr) /* Error */
  5977. +    {
  5978. +      DPRINT(10,("perform_reloc: Target is undefined section\n"));
  5979. +      return bfd_reloc_undefined;
  5980. +    }
  5981. +  
  5982. +  relocation=0; copy=FALSE; ret=bfd_reloc_ok;
  5983. +
  5984. +  switch(r->howto->type)
  5985. +    {
  5986. +    case HUNK_RELOC32: /* 32 bit reloc */
  5987. +      DPRINT(5,("RELOC32\n"));
  5988. +      size=2;
  5989. +      if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  5990. +    relocation=sym->value;
  5991. +      else if (target_section==bfd_com_section_ptr) /* ref to common */
  5992. +    {
  5993. +      relocation=0;
  5994. +      copy=TRUE;
  5995. +    }
  5996. +      else
  5997. +    {
  5998. +      /* If we access a symbol in the .bss section, we have to convert
  5999. +         this to an access to .data section */
  6000. +      /* This is done through a change to the symbol... */
  6001. +      if (amiga_base_relative && (strcmp(sym->section->output_section->name,
  6002. +                         ".bss")==0))
  6003. +        {
  6004. +          /* get value for .data section */
  6005. +          bfd *ibfd;
  6006. +          asection *s;
  6007. +
  6008. +          ibfd=target_section->output_section->owner;
  6009. +          for (s=ibfd->sections;s!=NULL;s=s->next)
  6010. +        if (strcmp(s->name,".data")==0)
  6011. +          {
  6012. +            sym->section->output_offset=s->_raw_size;
  6013. +            sym->section->output_section=s;
  6014. +          }
  6015. +        }
  6016. +
  6017. +      relocation=0;
  6018. +      copy=TRUE;
  6019. +    }
  6020. +      break;
  6021. +
  6022. +    case HUNK_RELOC8:
  6023. +    case HUNK_RELOC16:
  6024. +      DPRINT(5,("RELOC16/8\n"));
  6025. +      size=(r->howto->type==HUNK_RELOC8)?0:1;
  6026. +      if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  6027. +    relocation=sym->value;
  6028. +      else {
  6029. +    if (target_section==bfd_com_section_ptr) /* Error.. */
  6030. +      {
  6031. +        relocation=0;
  6032. +        copy=FALSE;
  6033. +        ret=bfd_reloc_undefined;
  6034. +      }
  6035. +    else
  6036. +      {
  6037. +        DPRINT(5,("PC relative\n"));
  6038. +        /* This is a pc relative hunk... */
  6039. +        if (sec->output_section!=target_section->output_section) /* Error */
  6040. +          {
  6041. +        DPRINT(10,("pc relative, but out of range I\n"));
  6042. +        relocation=0;
  6043. +        copy =FALSE;
  6044. +        ret=bfd_reloc_outofrange;
  6045. +          }
  6046. +        else
  6047. +          { /* Same section */
  6048. +        relocation=-(r->address+sec->output_offset);
  6049. +        copy=FALSE;
  6050. +          }
  6051. +      }
  6052. +      }
  6053. +      break;
  6054. +      
  6055. +    case HUNK_DREL32: /* baserel relocs */
  6056. +    case HUNK_DREL16:
  6057. +    case HUNK_DREL8:
  6058. +      DPRINT(5,("HUNK_BASEREL relocs\n"));
  6059. +
  6060. +      /* Relocs are always relative to the symbol ___a4_init */
  6061. +      /* Relocs to .bss section are converted to a reloc to .data section, since
  6062. +     .bss section contains only COMMON sections...... and should be
  6063. +     following .data section.. */
  6064. +
  6065. +      size=(r->howto->type==HUNK_DREL32)?2:((r->howto->type==HUNK_DREL16)?1:0);
  6066. +      
  6067. +      if (target_section==bfd_abs_section_ptr)
  6068. +    {
  6069. +      relocation=sym->value;
  6070. +    }
  6071. +      else 
  6072. +    {
  6073. +      if (! (AMIGA_DATA (target_section->output_section->owner)->baserel))
  6074. +        {
  6075. +          fprintf(stderr,"Base symbol for base relative reloc not defined,"
  6076. +              "section %s, reloc to symbol %s\n", sec->name, sym->name);
  6077. +          copy=FALSE;
  6078. +          ret=bfd_reloc_notsupported;
  6079. +          break;
  6080. +        }
  6081. +
  6082. +      /* If target->out is .bss, add the value of the .data section to sym->value and
  6083. +         set output_section new to .data section.... */
  6084. +      if (strcmp(target_section->output_section->name,".bss")==0)
  6085. +        {
  6086. +          bfd *ibfd;
  6087. +          asection *s;
  6088. +
  6089. +          ibfd=target_section->output_section->owner;
  6090. +          for (s=ibfd->sections;s!=NULL;s=s->next)
  6091. +        if (strcmp(s->name,".data")==0)
  6092. +          {
  6093. +            sym->section->output_section=s;
  6094. +            sym->section->output_offset=s->_raw_size;
  6095. +          }
  6096. +        }
  6097. +
  6098. +      relocation = sym->value + sym->section->output_offset
  6099. +        - (AMIGA_DATA (target_section->output_section->owner))->a4init
  6100. +        + r->addend;
  6101. +      copy=FALSE; 
  6102. +      sign = TRUE;
  6103. +    }
  6104. +      break;
  6105. +      
  6106. +    default:
  6107. +      fprintf(stderr,"Error:Not supported reloc type:%d\n",r->howto->type);
  6108. +      copy=FALSE;
  6109. +      relocation=0;
  6110. +      ret=bfd_reloc_notsupported;
  6111. +      break;
  6112. +    } /* Of switch */
  6113. +  
  6114. +  /* Add in relocation */
  6115. +  if (relocation!=0)
  6116. +    ret = my_add_to (data, r->address, size, relocation, sign);
  6117. +  
  6118. +  if (copy)/* Copy reloc to output section */
  6119. +    {
  6120. +      DPRINT(5,("Copying reloc\n"));
  6121. +      target_section=sec->output_section;
  6122. +      r->address+=sec->output_offset;
  6123. +      target_section->orelocation[target_section->reloc_count++]=r;
  6124. +      sec->output_section->flags|=SEC_RELOC;
  6125. +    }
  6126. +  DPRINT(5,("Leaving a_perform_reloc\n"));
  6127. +  return ret;
  6128. +}
  6129. +
  6130. +
  6131. +/* Perform an a.out reloc */
  6132. +static bfd_reloc_status_type 
  6133. +aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
  6134. +   bfd *abfd;
  6135. +   arelent *r;
  6136. +   PTR data;
  6137. +   asection *sec;
  6138. +   bfd *obfd;
  6139. +   char **error_message;
  6140. +{
  6141. +  asymbol *sym; /* Reloc is relative to this */
  6142. +  asection *target_section; /* reloc is relative to this section */
  6143. +  int relocation;
  6144. +  bfd_boolean copy, addval = TRUE;
  6145. +  bfd_reloc_status_type ret;
  6146. +  int size = 2;
  6147. +  int sign = FALSE;
  6148. +
  6149. +  /* If obfd==NULL: Apply the reloc, if possible. */
  6150. +  /* Else: Modify it and return */
  6151. +  DPRINT(5,("Entering aout_perf_reloc\n"));
  6152. +  if (obfd!=NULL) /* Only modify the reloc */
  6153. +    {
  6154. +      r->address+=sec->output_offset;
  6155. +      DPRINT(5,("Leaving aout_perf_reloc, modified\n"));
  6156. +      return bfd_reloc_ok;
  6157. +    }
  6158. +
  6159. +  sym=*(r->sym_ptr_ptr);
  6160. +  target_section=sym->section;
  6161. +
  6162. +  if (target_section==bfd_und_section_ptr) /* Error */
  6163. +    {
  6164. +      DPRINT(10,("target_sec=UND, aout_perf_rel\n"));
  6165. +      return bfd_reloc_undefined;
  6166. +    }
  6167. +  relocation=0; copy=FALSE; ret=bfd_reloc_ok;
  6168. +
  6169. +  switch (r->howto->type)
  6170. +    {
  6171. +    case 0: /* 8 bit reloc, pc relative or absolute */
  6172. +    case 1: /* 16 bit reloc */
  6173. +      DPRINT(10,("16/8 bit relative\n"));
  6174. +      size=r->howto->type;
  6175. +      if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  6176. +    relocation=sym->value;
  6177. +      else if (target_section==bfd_com_section_ptr) /* Error.. */
  6178. +    {
  6179. +      relocation=0;
  6180. +      copy=FALSE;
  6181. +      ret=bfd_reloc_undefined;
  6182. +      fprintf(stderr,"Pc relative relocation to  common symbol \"%s\" "
  6183. +          "in section %s\n", sym->name,sec->name);
  6184. +      DPRINT(10,("Ref to common symbol...aout_perf_reloc\n"));
  6185. +    }
  6186. +      else 
  6187. +    {
  6188. +      /* This is a pc relative hunk... or a baserel... */
  6189. +      if (sec->output_section!=target_section->output_section)
  6190. +        /* Error or baserel */
  6191. +        {
  6192. +          if (target_section->output_section->flags&SEC_DATA!=0)
  6193. +        /* Baserel reloc */
  6194. +        {
  6195. +          goto baserel; /* Dirty, but no code doubling.. */
  6196. +        }/* Of is baserel */
  6197. +
  6198. +          relocation=0;
  6199. +          copy =FALSE;
  6200. +          ret=bfd_reloc_outofrange;
  6201. +          fprintf(stderr,"pc relative relocation out of range in section"
  6202. +              "%s. Relocation was to symbol %s\n",sec->name,sym->name);
  6203. +
  6204. +          DPRINT(10,("Section%s, target %s: Reloc out of range..."
  6205. +             "not same section, aout_perf\nsec->out=%s, target->out"
  6206. +             "=%s, offset=%lx\n",sec->name, target_section->name,
  6207. +             sec->output_section->name,
  6208. +             target_section->output_section->name,r->address));
  6209. +        }
  6210. +      else
  6211. +        { /* Same section */
  6212. +          relocation=-(r->address+sec->output_offset);
  6213. +          copy=FALSE;
  6214. +          DPRINT(5,("Reloc to same section...\n"));
  6215. +        }
  6216. +    }
  6217. +      break;
  6218. +
  6219. +    case 4: /* 8 bit displacement */
  6220. +    case 5: /* 16 bit displacement */
  6221. +    case 6: /* 32 bit displacement */
  6222. +      size=r->howto->type - 4;
  6223. +      sign = TRUE;
  6224. +      if (target_section == bfd_abs_section_ptr) /* Ref to absolute hunk */
  6225. +    relocation = sym->value;
  6226. +      else
  6227. +         {
  6228. +           relocation = (sym->value + target_section->output_offset) -
  6229. +             (r->address + sec->output_offset);
  6230. +           if (size == 0)
  6231. +             relocation--;
  6232. +       addval = FALSE;
  6233. +       copy = 0;
  6234. +         }
  6235. +      break;
  6236. +
  6237. +    case 2: /* 32 bit reloc, abs. or relative */
  6238. +      DPRINT(10,("32 bit\n"));
  6239. +      size=2;
  6240. +      if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  6241. +    relocation=sym->value;
  6242. +      else if (target_section==bfd_com_section_ptr) /* ref to common */
  6243. +    {
  6244. +      relocation=0;
  6245. +      copy=TRUE;
  6246. +    }
  6247. +      else
  6248. +    {
  6249. +      /* If we access a symbol in the .bss section, we have to convert
  6250. +         this to an access to .data section*/
  6251. +      /* This is done through a change to the output section of
  6252. +         the symbol... */
  6253. +      if (amiga_base_relative && (strcmp(sym->section->output_section->name,
  6254. +                         ".bss")==0))
  6255. +        {
  6256. +          /* get value for .data section */
  6257. +          bfd *ibfd;
  6258. +          asection *s;
  6259. +
  6260. +          ibfd=target_section->output_section->owner;
  6261. +          for (s=ibfd->sections;s!=NULL;s=s->next)
  6262. +        if (strcmp(s->name,".data")==0)
  6263. +          {
  6264. +            sym->section->output_section=s;
  6265. +            sym->section->output_offset+=s->_raw_size;
  6266. +          }
  6267. +        }
  6268. +      relocation=0;
  6269. +      copy=TRUE;
  6270. +    }
  6271. +      DPRINT(10,("target->out=%s(%lx), sec->out=%s(%lx), symbol=%s\n",
  6272. +         target_section->output_section->name,
  6273. +         target_section->output_section,sec->output_section->name,
  6274. +         sec->output_section,sym->name));
  6275. +      break;
  6276. +
  6277. +    case 9: /* 16 bit base relative */
  6278. +    case 10: /* 32 bit base relative */
  6279. +      DPRINT(10,("32/16 bit baserel\n"));
  6280. +      /* We use the symbol ___a4_init as base */
  6281. +      size=r->howto->type-8;
  6282. +      
  6283. +    baserel: 
  6284. +      if (target_section==bfd_abs_section_ptr)
  6285. +    {
  6286. +      relocation=sym->value;
  6287. +    }
  6288. +      else if (target_section==bfd_com_section_ptr) /* Error.. */
  6289. +    {
  6290. +      relocation=0;
  6291. +      copy=FALSE;
  6292. +      ret=bfd_reloc_undefined;
  6293. +      fprintf(stderr,"Baserelative relocation to common \"%s\"\n",
  6294. +          sym->name);
  6295. +
  6296. +      DPRINT(10,("Ref to common symbol...aout_perf_reloc\n"));
  6297. +    }
  6298. +      else /* Target section and sec need not be the same... */
  6299. +    {
  6300. +      if (! (AMIGA_DATA (target_section->output_section->owner)->baserel))
  6301. +
  6302. +        {
  6303. +          fprintf(stderr,"Base symbol for base relative reloc not defined,"
  6304. +              "section %s, reloc to symbol %s\n", sec->name, sym->name);
  6305. +          copy=FALSE;
  6306. +          ret=bfd_reloc_notsupported;
  6307. +          DPRINT(10,("target->out=%s(%lx), sec->out=%s(%lx), symbol=%s\n",
  6308. +             target_section->output_section->name,
  6309. +             target_section->output_section,
  6310. +             sec->output_section->name,
  6311. +             sec->output_section,sym->name));
  6312. +          
  6313. +          break;
  6314. +        }
  6315. +      
  6316. +      /* If target->out is .bss, add the value of the .data section....
  6317. +         to sym, set new output_section */
  6318. +      if (strcmp(target_section->output_section->name,".bss")==0)
  6319. +        {
  6320. +          bfd *ibfd;
  6321. +          asection *s;
  6322. +
  6323. +          ibfd=target_section->output_section->owner;
  6324. +
  6325. +          for (s=ibfd->sections;s!=NULL;s=s->next)
  6326. +        if (strcmp(s->name,".data")==0)
  6327. +          {
  6328. +            sym->section->output_offset+=s->_raw_size;
  6329. +            sym->section->output_section=s;
  6330. +          }
  6331. +        }
  6332. +
  6333. +      relocation = sym->value+target_section->output_offset - 0x7ffe;
  6334. +
  6335. +      /* if the symbol is in bss, subtract the offset that gas has put
  6336. +         into the opcode */
  6337. +      if (target_section->index == 2)
  6338. +        relocation -= abfd->tdata.aout_data->a.datasec->_raw_size;
  6339. +
  6340. +      addval = TRUE;
  6341. +      copy = FALSE;
  6342. +      sign = TRUE;
  6343. +
  6344. +      DPRINT (20, ("symbol=%s (0x%lx)\nsection %s (0x%lx; %s; output=0x%lx)"
  6345. +               "\nrelocation @0x%lx\n\n", sym->name, sym->value,
  6346. +               sym->section->name, (unsigned long)sym->section,
  6347. +               sym->section->owner->filename, sym->section->output_offset,
  6348. +               r->address));
  6349. +    }
  6350. +      DPRINT(10,("target->out=%s(%lx), sec->out=%s(%lx), symbol=%s\n",
  6351. +         target_section->output_section->name,
  6352. +         target_section->output_section,sec->output_section->name,
  6353. +         sec->output_section,sym->name));
  6354. +      break;
  6355. +      
  6356. +    default:
  6357. +      copy=FALSE;
  6358. +      relocation=0;
  6359. +      ret=bfd_reloc_notsupported;
  6360. +      fprintf(stderr,"Unsupported reloc: %d\n",r->howto->type);
  6361. +      break;
  6362. +
  6363. +    }/* Of switch */
  6364. +
  6365. +  /* Add in relocation */
  6366. +  if (relocation!=0)
  6367. +    if (addval)
  6368. +      ret = my_add_to (data, r->address,size, relocation, sign);
  6369. +    else
  6370. +      ret = my_set_to (data, r->address, size, relocation, sign);
  6371. +
  6372. +  if (copy)/* Copy reloc to output section */
  6373. +    {
  6374. +      DPRINT(5,("Copying reloc\n"));
  6375. +      target_section=sec->output_section;
  6376. +      r->address+=sec->output_offset;
  6377. +      target_section->orelocation[target_section->reloc_count++]=r;
  6378. +    }
  6379. +  DPRINT(5,("Leaving aout_perf_reloc with %d (OK=%d)\n",ret,bfd_reloc_ok));
  6380. +  return ret;
  6381. +}
  6382. +
  6383. +
  6384. +/* The final link routine, used both by Amiga and a.out backend*/
  6385. +/* This is nearly a copy of _bfd_generic_final_link */
  6386. +bfd_boolean
  6387. +amiga_final_link (abfd, info)
  6388. +     bfd *abfd;
  6389. +     struct bfd_link_info *info;
  6390. +{
  6391. +  bfd *sub;
  6392. +  asection *o,*act_sec;
  6393. +  struct bfd_link_order *p;
  6394. +  size_t outsymalloc;
  6395. +  struct generic_write_global_symbol_info wginfo;
  6396. +  struct bfd_link_hash_entry *h =
  6397. +    bfd_link_hash_lookup (info->hash, "___a4_init", FALSE, FALSE, TRUE);
  6398. +
  6399. +  if (h && h->type == bfd_link_hash_defined) {
  6400. +    AMIGA_DATA (abfd)->baserel = TRUE;
  6401. +    AMIGA_DATA (abfd)->a4init = h->u.def.value;
  6402. +  }
  6403. +  else
  6404. +    AMIGA_DATA (abfd)->baserel = FALSE;
  6405. +
  6406. +  DPRINT(5,("Entering final_link\n"));
  6407. +
  6408. +  if (abfd->xvec->flavour == bfd_target_aout_flavour)
  6409. +    return amiga_aout_bfd_final_link(abfd, info);
  6410. +
  6411. +  abfd->outsymbols = (asymbol **) NULL;
  6412. +  abfd->symcount = 0;
  6413. +  outsymalloc = 0;
  6414. +
  6415. +  /* Mark all sections which will be included in the output file.  */
  6416. +  for (o = abfd->sections; o != NULL; o = o->next)
  6417. +    for (p = o->link_order_head; p != NULL; p = p->next)
  6418. +      if (p->type == bfd_indirect_link_order)
  6419. +    p->u.indirect.section->linker_mark = TRUE;
  6420. +
  6421. +  /* Build the output symbol table.  */
  6422. +  for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next)
  6423. +    if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc))
  6424. +      return FALSE;
  6425. +
  6426. +  DPRINT(10,("Did build output symbol table\n"));
  6427. +
  6428. +  /* Accumulate the global symbols.  */
  6429. +  wginfo.info = info;
  6430. +  wginfo.output_bfd = abfd;
  6431. +  wginfo.psymalloc = &outsymalloc;
  6432. +  _bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info),
  6433. +                                   _bfd_generic_link_write_global_symbol,
  6434. +                                   (PTR) &wginfo);
  6435. +
  6436. +  DPRINT(10,("Accumulated global symbols\n"));
  6437. +
  6438. +  DPRINT(10,("Output bfd is %s(%lx)\n",abfd->filename,abfd));
  6439. +
  6440. +  /* Allocate space for the output relocs for each section.  */
  6441. +  /* We also handle base-relative linking special, by setting the .data
  6442. +     sections real length to it's length + .bss length */
  6443. +  /* This is different to bfd_generic_final_link: We ALWAYS alloc space for
  6444. +     the relocs, because we may need it anyway */
  6445. +  for (o = abfd->sections;
  6446. +       o != (asection *) NULL;
  6447. +       o = o->next)
  6448. +    {
  6449. +      /* If section is .data, find .bss and add that length */
  6450. +      if (!info->relocateable && amiga_base_relative &&
  6451. +      (strcmp(o->name,".data")==0))
  6452. +    {
  6453. +      if (abfd->xvec->flavour!=bfd_target_amiga_flavour) /* oops */
  6454. +        {
  6455. +          fprintf(stderr,"You can't use base relative linking with"
  6456. +              " partial links.\n");
  6457. +        }
  6458. +      else
  6459. +        {
  6460. +#if 0
  6461. +          for (act_sec=abfd->sections; act_sec!=NULL;act_sec=act_sec->next)
  6462. +        if (strcmp(act_sec->name,".bss")==0)
  6463. +          amiga_per_section(o)->disk_size = o->_raw_size +
  6464. +            act_sec->_raw_size;
  6465. +#endif
  6466. +        }
  6467. +    }/* Of base-relative linking */
  6468. +
  6469. +      DPRINT(10,("Section in output bfd is %s (%lx)\n",o->name,o));
  6470. +
  6471. +      o->reloc_count = 0;
  6472. +      for (p = o->link_order_head;
  6473. +       p != (struct bfd_link_order *) NULL;
  6474. +       p = p->next)
  6475. +    {
  6476. +      if (p->type == bfd_section_reloc_link_order
  6477. +          || p->type == bfd_symbol_reloc_link_order)
  6478. +        ++o->reloc_count;
  6479. +      else if (p->type == bfd_indirect_link_order)
  6480. +        {
  6481. +          asection *input_section;
  6482. +          bfd *input_bfd;
  6483. +          long relsize;
  6484. +          arelent **relocs;
  6485. +          asymbol **symbols;
  6486. +          long reloc_count;
  6487. +          
  6488. +          input_section = p->u.indirect.section;
  6489. +          input_bfd = input_section->owner;
  6490. +
  6491. +          DPRINT(10,("\tIndirect section from bfd %s, section is %s(%lx)"
  6492. +             " (COM=%lx)\n",
  6493. +             input_bfd->filename,input_section->name,input_section,
  6494. +             bfd_com_section_ptr));
  6495. +
  6496. +          relsize = bfd_get_reloc_upper_bound (input_bfd,
  6497. +                           input_section);
  6498. +          if (relsize < 0)
  6499. +        {
  6500. +          DPRINT(10,("Relsize<0.I..in bfd %s, sec %s\n",
  6501. +                 input_bfd->filename, input_section->name));
  6502. +          return FALSE;
  6503. +        }
  6504. +
  6505. +          relocs = (arelent **) malloc ((size_t) relsize);
  6506. +
  6507. +          if (!relocs && relsize != 0)
  6508. +        {
  6509. +          bfd_set_error (bfd_error_no_memory);
  6510. +          return FALSE;
  6511. +        }
  6512. +          symbols = _bfd_generic_link_get_symbols (input_bfd);
  6513. +          reloc_count = bfd_canonicalize_reloc (input_bfd,
  6514. +                            input_section,
  6515. +                            relocs,
  6516. +                            symbols);
  6517. +          if (reloc_count < 0)
  6518. +        {
  6519. +          DPRINT(10,("Relsize<0.II..in bfd %s, sec %s\n",
  6520. +                 input_bfd->filename, input_section->name));
  6521. +          return FALSE;
  6522. +        }
  6523. +
  6524. +          BFD_ASSERT (reloc_count == input_section->reloc_count);
  6525. +          o->reloc_count += reloc_count;
  6526. +          free (relocs);
  6527. +        }
  6528. +    }
  6529. +      if (o->reloc_count > 0)
  6530. +    {
  6531. +      o->orelocation = ((arelent **)
  6532. +                bfd_alloc (abfd,
  6533. +                       (o->reloc_count
  6534. +                    * sizeof (arelent *))));
  6535. +
  6536. +      if (!o->orelocation)
  6537. +        {
  6538. +          bfd_set_error (bfd_error_no_memory);
  6539. +          return FALSE;
  6540. +        }
  6541. +      /* o->flags |= SEC_RELOC; There may be no relocs. This can be
  6542. +         determined only later */
  6543. +      /* Reset the count so that it can be used as an index
  6544. +         when putting in the output relocs.  */
  6545. +      o->reloc_count = 0;
  6546. +    }
  6547. +    }
  6548. +
  6549. +  DPRINT(10,("Got all relocs\n"));
  6550. +
  6551. +  /* Handle all the link order information for the sections.  */
  6552. +  for (o = abfd->sections;
  6553. +       o != (asection *) NULL;
  6554. +       o = o->next)
  6555. +    {
  6556. +      for (p = o->link_order_head;
  6557. +           p != (struct bfd_link_order *) NULL;
  6558. +           p = p->next)
  6559. +        {
  6560. +          switch (p->type)
  6561. +            {
  6562. +            case bfd_section_reloc_link_order:
  6563. +            case bfd_symbol_reloc_link_order:
  6564. +              if (! amiga_reloc_link_order (abfd, info, o, p)) /* We use an own routine */
  6565. +                return FALSE;
  6566. +              break;
  6567. +            case bfd_indirect_link_order:
  6568. +              if (! default_indirect_link_order (abfd, info, o, p, FALSE)) 
  6569. +        /* Calls our get_relocated_section_contents*/
  6570. +                return FALSE;
  6571. +              break;
  6572. +            default:
  6573. +              if (! _bfd_default_link_order (abfd, info, o, p))
  6574. +                return FALSE;
  6575. +              break;
  6576. +            }
  6577. +        }
  6578. +    }
  6579. +  if (abfd->xvec->flavour==bfd_target_amiga_flavour&&!info->relocateable)
  6580. +    AMIGA_DATA(abfd)->IsLoadFile=TRUE;
  6581. +
  6582. +  DPRINT(10,("Leaving final_link\n"));
  6583. +  return TRUE;
  6584. +}
  6585. +
  6586. +
  6587. +/* Handle reloc link order . This is nearly a copy from generic_reloc_link_order
  6588. +   in linker.c*/
  6589. +static bfd_boolean 
  6590. +amiga_reloc_link_order(abfd, info, sec, link_order)
  6591. +  bfd *abfd;
  6592. +  struct bfd_link_info *info;
  6593. +  asection *sec;
  6594. +  struct bfd_link_order *link_order;
  6595. +{
  6596. +   amiga_reloc_type *r;
  6597. +
  6598. +   DPRINT(5,("Entering amiga_reloc_link_order\n"));
  6599. +
  6600. +   /* We generate a new AMIGA style reloc */
  6601. +   BFD_ASSERT(sec->orelocation!=NULL);
  6602. +
  6603. +   if (sec->orelocation == (arelent **) NULL)
  6604. +     {
  6605. +       DPRINT(10,("aborting, since orelocation==NULL\n"));
  6606. +       abort ();
  6607. +     }
  6608. +
  6609. +   r = (amiga_reloc_type *) bfd_zalloc (abfd, sizeof (amiga_reloc_type));
  6610. +   if (r ==  NULL)
  6611. +     {
  6612. +       bfd_set_error (bfd_error_no_memory);
  6613. +       DPRINT(5,("Leaving amiga_reloc_link, no mem\n"));
  6614. +       return FALSE;
  6615. +     }
  6616. +   
  6617. +   r->relent.address = link_order->offset;
  6618. +   r->relent.howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
  6619. +   if (r->relent.howto ==  NULL)
  6620. +     {
  6621. +       bfd_set_error (bfd_error_bad_value);
  6622. +       DPRINT(5,("Leaving amiga_reloc_link, bad value\n"));
  6623. +       return FALSE;
  6624. +     }
  6625. +   
  6626. +   /* Get the symbol to use for the relocation.  */
  6627. +   if (link_order->type == bfd_section_reloc_link_order)
  6628. +     r->relent.sym_ptr_ptr = link_order->u.reloc.p->u.section->symbol_ptr_ptr;
  6629. +   else
  6630. +     {
  6631. +       struct generic_link_hash_entry *h;
  6632. +       
  6633. +       h = _bfd_generic_link_hash_lookup (_bfd_generic_hash_table (info),
  6634. +                      link_order->u.reloc.p->u.name,
  6635. +                      FALSE, FALSE, TRUE);
  6636. +       if (h == (struct generic_link_hash_entry *) NULL
  6637. +       || ! h->written)
  6638. +     {
  6639. +       if (! ((*info->callbacks->unattached_reloc)
  6640. +          (info, link_order->u.reloc.p->u.name,
  6641. +           (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
  6642. +         return FALSE;
  6643. +       bfd_set_error (bfd_error_bad_value);
  6644. +       DPRINT(5,("Leaving amiga_reloc_link, bad value in hash lookup\n"));
  6645. +       return FALSE;
  6646. +     }
  6647. +       r->relent.sym_ptr_ptr = &h->sym;
  6648. +     }
  6649. +   DPRINT(5,("Got symbol for relocation\n"));
  6650. +   /* Store the addend */
  6651. +   r->relent.addend = link_order->u.reloc.p->addend;
  6652. +
  6653. +
  6654. +   /* If we are generating relocateable output, just add the reloc */
  6655. +   if (info->relocateable)
  6656. +     {
  6657. +       DPRINT(5,("Adding reloc\n"));
  6658. +       sec->orelocation[sec->reloc_count] = (arelent *)r;
  6659. +       ++sec->reloc_count; 
  6660. +       sec->flags|=SEC_RELOC;
  6661. +     }
  6662. +   else
  6663. +     { /* Try to apply the reloc */
  6664. +       char *em="";
  6665. +       PTR data;
  6666. +       bfd_reloc_status_type ret;
  6667. +
  6668. +       DPRINT(5,("Apply link_order_reloc\n"));
  6669. +       /*FIXME: Maybe, we have to get the section contents, before we use them,
  6670. +     if they have not been
  6671. +     set by now.. */
  6672. +
  6673. +       BFD_ASSERT(sec->contents!=NULL);
  6674. +       data=(PTR)(sec->contents);
  6675. +
  6676. +       if (bfd_get_flavour(abfd)==bfd_target_amiga_flavour)
  6677. +     ret=amiga_perform_reloc(abfd,(arelent *)r,data,sec,NULL,&em);
  6678. +       else
  6679. +     ret=aout_perform_reloc(abfd,(arelent *)r,data,sec,NULL,&em);
  6680. +
  6681. +       if (ret!=bfd_reloc_ok)
  6682. +     {
  6683. +       DPRINT(5,("Leaving amiga_reloc_link, value FALSE\n"));
  6684. +       return FALSE;
  6685. +     }
  6686. +     }
  6687. +   DPRINT(5,("Leaving amiga_reloc_link\n"));
  6688. +   return TRUE;
  6689. +}
  6690. diff -urNEBb binutils-2.14-orig/bfd/aout-amiga.c binutils-2.14/bfd/aout-amiga.c
  6691. --- binutils-2.14-orig/bfd/aout-amiga.c    1970-01-01 01:00:00.000000000 +0100
  6692. +++ binutils-2.14/bfd/aout-amiga.c    2003-12-02 14:09:39.000000000 +0100
  6693. @@ -0,0 +1,54 @@
  6694. +/* BFD backend for Amiga style a.out with flags set to 0
  6695. +   Copyright (C) 1990, 91, 92, 93, 1994 Free Software Foundation, Inc.
  6696. +   Written by Stephan Thesing.
  6697. +
  6698. +This file is part of BFD, the Binary File Descriptor library.
  6699. +
  6700. +This program is free software; you can redistribute it and/or modify
  6701. +it under the terms of the GNU General Public License as published by
  6702. +the Free Software Foundation; either version 2 of the License, or
  6703. +(at your option) any later version.
  6704. +
  6705. +This program is distributed in the hope that it will be useful,
  6706. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  6707. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6708. +GNU General Public License for more details.
  6709. +
  6710. +You should have received a copy of the GNU General Public License
  6711. +along with this program; if not, write to the Free Software
  6712. +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  6713. +
  6714. +#define TARGETNAME "a.out-amiga"
  6715. +
  6716. +/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
  6717. +   remove whitespace added here, and thus will fail to concatenate
  6718. +   the tokens.  */
  6719. +#define MY(OP) CONCAT2 (aout_amiga_,OP)
  6720. +
  6721. +#include "bfd.h"
  6722. +
  6723. +#define MY_exec_hdr_flags 0
  6724. +
  6725. +extern bfd_boolean
  6726. +amiga_final_link(bfd *,struct bfd_link_info *);
  6727. +#define MY_bfd_final_link amiga_final_link
  6728. +
  6729. +extern bfd_byte *
  6730. +get_relocated_section_contents(bfd *, struct bfd_link_info *,
  6731. +                   struct bfd_link_order *, bfd_byte *,
  6732. +                   bfd_boolean , asymbol **);
  6733. +#define MY_bfd_get_relocated_section_contents get_relocated_section_contents
  6734. +
  6735. +/* Include the usual a.out support.  */
  6736. +#include "aoutf1.h"
  6737. +
  6738. +/* Final link routine.  We need to use a call back to get the correct
  6739. +   offsets in the output file.  */
  6740. +
  6741. +bfd_boolean
  6742. +amiga_aout_bfd_final_link (abfd, info)
  6743. +     bfd *abfd;
  6744. +     struct bfd_link_info *info;
  6745. +{
  6746. +  return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
  6747. +}
  6748. diff -urNEBb binutils-2.14-orig/bfd/aoutx.h binutils-2.14/bfd/aoutx.h
  6749. --- binutils-2.14-orig/bfd/aoutx.h    2003-03-31 19:13:24.000000000 +0200
  6750. +++ binutils-2.14/bfd/aoutx.h    2003-12-02 14:09:39.000000000 +0100
  6751. @@ -133,7 +133,8 @@
  6752.    PARAMS ((bfd *));
  6753.  static bfd_boolean translate_from_native_sym_flags
  6754.    PARAMS ((bfd *, aout_symbol_type *));
  6755. -static bfd_boolean translate_to_native_sym_flags
  6756. +/*Amiga hack - used in amigaos.c, must be global */
  6757. +/*static*/ bfd_boolean translate_to_native_sym_flags
  6758.    PARAMS ((bfd *, asymbol *, struct external_nlist *));
  6759.  static void adjust_o_magic
  6760.    PARAMS ((bfd *, struct internal_exec *));
  6761. @@ -1657,7 +1658,7 @@
  6762.  
  6763.  /* Set the fields of SYM_POINTER according to CACHE_PTR.  */
  6764.  
  6765. -static bfd_boolean
  6766. +/*static*/ bfd_boolean
  6767.  translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
  6768.       bfd *abfd;
  6769.       asymbol *cache_ptr;
  6770. @@ -2065,12 +2066,31 @@
  6771.  
  6772.    PUT_WORD (abfd, g->address, natptr->r_address);
  6773.  
  6774. -  r_length = g->howto->size ;    /* Size as a power of two.  */
  6775. +  r_length = g->howto->size ;    /* Size as a power of two */
  6776.    r_pcrel  = (int) g->howto->pc_relative; /* Relative to PC?  */
  6777. +#if 1
  6778. +  /* FIXME! "#if 1" is the wrong way to select this Amiga specific code.
  6779. +   We can't just test for __amigaos__ defined either, since we may be
  6780. +   building a cross compiler and __amigaos__ is only defined if the
  6781. +   compiler we are using is targeted for the Amiga. */
  6782. +  /* Changed for cooperation with AMIGA backend */
  6783. +  /* This only applies, if aout flavour    191194 ST*/
  6784.    /* XXX This relies on relocs coming from a.out files.  */
  6785. +  if (bfd_asymbol_bfd(sym)->xvec->flavour==bfd_target_aout_flavour)
  6786. +    {
  6787.    r_baserel = (g->howto->type & 8) != 0;
  6788.    r_jmptable = (g->howto->type & 16) != 0;
  6789.    r_relative = (g->howto->type & 32) != 0;
  6790. +    }
  6791. +  else
  6792. +    {
  6793. +      r_baserel=r_jmptable=r_relative=0;
  6794. +    }
  6795. +#else
  6796. +  r_baserel = (g->howto->type & 8) != 0;
  6797. +  r_jmptable = (g->howto->type & 16) != 0;
  6798. +  r_relative = (g->howto->type & 32) != 0;
  6799. +#endif
  6800.  
  6801.  #if 0
  6802.    /* For a standard reloc, the addend is in the object file.  */
  6803. @@ -2369,8 +2389,12 @@
  6804.    /* Base relative relocs are always against the symbol table,
  6805.       regardless of the setting of r_extern.  r_extern just reflects
  6806.       whether the symbol the reloc is against is local or global.  */
  6807. +#if 0
  6808. +  /* FIXME! "#if 0" is the wrong way to disable this code.  See comment
  6809. +     earlier in file. */
  6810.    if (r_baserel)
  6811.      r_extern = 1;
  6812. +#endif
  6813.  
  6814.    if (r_extern && r_index > symcount)
  6815.      {
  6816. diff -urNEBb binutils-2.14-orig/bfd/bfd-in2.h binutils-2.14/bfd/bfd-in2.h
  6817. --- binutils-2.14-orig/bfd/bfd-in2.h    2003-05-03 17:06:56.000000000 +0200
  6818. +++ binutils-2.14/bfd/bfd-in2.h    2003-12-02 14:09:39.000000000 +0100
  6819. @@ -2484,6 +2484,10 @@
  6820.    BFD_RELOC_PPC_EMB_RELST_HA,
  6821.    BFD_RELOC_PPC_EMB_BIT_FLD,
  6822.    BFD_RELOC_PPC_EMB_RELSDA,
  6823. +  BFD_RELOC_PPC_MORPHOS_DREL,
  6824. +  BFD_RELOC_PPC_MORPHOS_DREL_LO,
  6825. +  BFD_RELOC_PPC_MORPHOS_DREL_HI,
  6826. +  BFD_RELOC_PPC_MORPHOS_DREL_HA,
  6827.    BFD_RELOC_PPC64_HIGHER,
  6828.    BFD_RELOC_PPC64_HIGHER_S,
  6829.    BFD_RELOC_PPC64_HIGHEST,
  6830. @@ -3806,6 +3810,7 @@
  6831.        struct cisco_core_struct *cisco_core_data;
  6832.        struct versados_data_struct *versados_data;
  6833.        struct netbsd_core_struct *netbsd_core_data;
  6834. +      struct amiga_data_struct *amiga_data;
  6835.        struct mach_o_data_struct *mach_o_data;
  6836.        struct mach_o_fat_data_struct *mach_o_fat_data;
  6837.        struct bfd_pef_data_struct *pef_data;
  6838. @@ -4069,6 +4074,7 @@
  6839.  enum bfd_flavour
  6840.  {
  6841.    bfd_target_unknown_flavour,
  6842. +  bfd_target_amiga_flavour,
  6843.    bfd_target_aout_flavour,
  6844.    bfd_target_coff_flavour,
  6845.    bfd_target_ecoff_flavour,
  6846. diff -urNEBb binutils-2.14-orig/bfd/bfd.c binutils-2.14/bfd/bfd.c
  6847. --- binutils-2.14-orig/bfd/bfd.c    2003-03-01 00:43:34.000000000 +0100
  6848. +++ binutils-2.14/bfd/bfd.c    2003-12-02 14:09:39.000000000 +0100
  6849. @@ -183,6 +183,7 @@
  6850.  .      struct cisco_core_struct *cisco_core_data;
  6851.  .      struct versados_data_struct *versados_data;
  6852.  .      struct netbsd_core_struct *netbsd_core_data;
  6853. +.      struct amiga_data_struct *amiga_data;
  6854.  .      struct mach_o_data_struct *mach_o_data;
  6855.  .      struct mach_o_fat_data_struct *mach_o_fat_data;
  6856.  .      struct bfd_pef_data_struct *pef_data;
  6857. diff -urNEBb binutils-2.14-orig/bfd/bfdio.c binutils-2.14/bfd/bfdio.c
  6858. --- binutils-2.14-orig/bfd/bfdio.c    2002-11-18 17:37:52.000000000 +0100
  6859. +++ binutils-2.14/bfd/bfdio.c    2003-12-02 17:43:31.000000000 +0100
  6860. @@ -325,7 +325,32 @@
  6861.    if (direction == SEEK_SET && abfd->my_archive != NULL)
  6862.      file_position += abfd->origin;
  6863.  
  6864. +#ifndef __amigaos__
  6865.    result = fseek (f, file_position, direction);
  6866. +#else
  6867. +  {
  6868. +    struct stat stat_buf;
  6869. +    if (direction == SEEK_CUR)
  6870. +      file_position += ftell (f);
  6871. +    fflush (f);
  6872. +    if (!(result = fstat (fileno (f), &stat_buf)) &&
  6873. +    file_position > stat_buf.st_size &&
  6874. +    !(result = fseek (f, stat_buf.st_size, SEEK_SET))) {
  6875. +      int zeroes = file_position - stat_buf.st_size;
  6876. +      char *buf = calloc (4096, 1);
  6877. +      if (buf) {
  6878. +    while (zeroes > 0) {
  6879. +      int r, x = (zeroes > 4096? 4096 : zeroes);
  6880. +      if ((r = write (fileno (f), buf, x))<=0)
  6881. +        break;
  6882. +      zeroes -= r;
  6883. +    }
  6884. +    free (buf);
  6885. +      }
  6886. +    }
  6887. +    result = fseek (f, file_position, SEEK_SET);
  6888. +  }
  6889. +#endif
  6890.    if (result != 0)
  6891.      {
  6892.        int hold_errno = errno;
  6893. diff -urNEBb binutils-2.14-orig/bfd/config.bfd binutils-2.14/bfd/config.bfd
  6894. --- binutils-2.14-orig/bfd/config.bfd    2003-06-02 21:35:20.000000000 +0200
  6895. +++ binutils-2.14/bfd/config.bfd    2003-12-02 14:09:39.000000000 +0100
  6896. @@ -38,7 +38,7 @@
  6897.  c54x*)             targ_archs=bfd_tic54x_arch ;;
  6898.  dlx*)         targ_archs=bfd_dlx_arch ;;
  6899.  hppa*)             targ_archs=bfd_hppa_arch ;;
  6900. -i[3456]86)       targ_archs=bfd_i386_arch ;;
  6901. +i[3456]86*)      targ_archs=bfd_i386_arch ;;
  6902.  i370)            targ_archs=bfd_i370_arch ;;
  6903.  m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
  6904.  m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
  6905. @@ -543,6 +543,11 @@
  6906.      targ_selfvecs=i386chaos_vec
  6907.      ;;
  6908.  
  6909. +  i[3456]86be-*-amithlon*)
  6910. +    targ_defvec=bfd_elf32_i386be_amithlon_vec
  6911. +    targ_selvecs="bfd_elf32_i386_vec bfd_elf32_i386be_amithlon_vec"
  6912. +    ;;
  6913. +
  6914.    i860-*-mach3* | i860-*-osf1* | i860-*-coff*)
  6915.      targ_defvec=i860coff_vec
  6916.      ;;
  6917. @@ -605,6 +610,10 @@
  6918.    m68*-motorola-sysv*)
  6919.      targ_defvec=m68ksysvcoff_vec
  6920.      ;;
  6921. +  m68*-*-amigaos*)
  6922. +    targ_defvec=amiga_vec
  6923. +    targ_selvecs="aout_amiga_vec amiga_vec"
  6924. +    ;;
  6925.    m68*-hp-bsd*)
  6926.      targ_defvec=hp300bsd_vec
  6927.      targ_underscore=yes
  6928. @@ -684,7 +693,7 @@
  6929.      targ_selvecs="m68kcoff_vec versados_vec tekhex_vec"
  6930.      targ_underscore=yes
  6931.      ;;
  6932. -  m68*-cbm-*)
  6933. +  m68*-cbm-amix)
  6934.      targ_defvec=bfd_elf32_m68k_vec
  6935.      targ_selvecs=m68kcoff_vec
  6936.      ;;
  6937. @@ -892,6 +901,18 @@
  6938.      targ_cflags=-DSMALL_ARCHIVE;;
  6939.      esac
  6940.      ;;
  6941. +  powerpc-*-amigaoshunk*)
  6942. +    targ_defvec=amiga_vec
  6943. +    targ_selvecs="bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec aout_amiga_vec"
  6944. +    ;;
  6945. +  powerpc-*-amigaos*)
  6946. +    targ_defvec=bfd_elf32_powerpc_vec
  6947. +    targ_selvecs="bfd_elf32_powerpcle_vec"
  6948. +    ;;
  6949. +  powerpc-*-morphos*)
  6950. +    targ_defvec=bfd_elf32_morphos_vec
  6951. +    targ_selvecs="bfd_elf32_morphos_vec"
  6952. +    ;;
  6953.  #ifdef BFD64
  6954.    powerpc64-*-aix*)
  6955.      targ_defvec=rs6000coff64_vec
  6956. @@ -907,6 +928,10 @@
  6957.      targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec"
  6958.      ;;
  6959.  #endif
  6960. +  powerpc-*-amiga*)
  6961. +    targ_defvec=bfd_elf32_amiga_vec
  6962. +    targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec ppcboot_vec"
  6963. +    ;;
  6964.    powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
  6965.    powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
  6966.    powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
  6967. diff -urNEBb binutils-2.14-orig/bfd/configure binutils-2.14/bfd/configure
  6968. --- binutils-2.14-orig/bfd/configure    2003-06-12 15:25:46.000000000 +0200
  6969. +++ binutils-2.14/bfd/configure    2003-12-15 12:05:30.000000000 +0100
  6970. @@ -1,57 +1,324 @@
  6971.  #! /bin/sh
  6972. -
  6973.  # Guess values for system-dependent variables and create Makefiles.
  6974. -# Generated automatically using autoconf version 2.13 
  6975. -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
  6976. +# Generated by GNU Autoconf 2.57.
  6977.  #
  6978. +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
  6979. +# Free Software Foundation, Inc.
  6980.  # This configure script is free software; the Free Software Foundation
  6981.  # gives unlimited permission to copy, distribute and modify it.
  6982. +## --------------------- ##
  6983. +## M4sh Initialization.  ##
  6984. +## --------------------- ##
  6985. +
  6986. +# Be Bourne compatible
  6987. +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  6988. +  emulate sh
  6989. +  NULLCMD=:
  6990. +  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  6991. +  # is contrary to our usage.  Disable this feature.
  6992. +  alias -g '${1+"$@"}'='"$@"'
  6993. +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
  6994. +  set -o posix
  6995. +fi
  6996. +
  6997. +# Support unset when possible.
  6998. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
  6999. +  as_unset=unset
  7000. +else
  7001. +  as_unset=false
  7002. +fi
  7003. +
  7004. +
  7005. +# Work around bugs in pre-3.0 UWIN ksh.
  7006. +$as_unset ENV MAIL MAILPATH
  7007. +PS1='$ '
  7008. +PS2='> '
  7009. +PS4='+ '
  7010. +
  7011. +# NLS nuisances.
  7012. +for as_var in \
  7013. +  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
  7014. +  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
  7015. +  LC_TELEPHONE LC_TIME
  7016. +do
  7017. +  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
  7018. +    eval $as_var=C; export $as_var
  7019. +  else
  7020. +    $as_unset $as_var
  7021. +  fi
  7022. +done
  7023. +
  7024. +# Required to use basename.
  7025. +if expr a : '\(a\)' >/dev/null 2>&1; then
  7026. +  as_expr=expr
  7027. +else
  7028. +  as_expr=false
  7029. +fi
  7030. +
  7031. +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
  7032. +  as_basename=basename
  7033. +else
  7034. +  as_basename=false
  7035. +fi
  7036. +
  7037. +
  7038. +# Name of the executable.
  7039. +as_me=`$as_basename "$0" ||
  7040. +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
  7041. +     X"$0" : 'X\(//\)$' \| \
  7042. +     X"$0" : 'X\(/\)$' \| \
  7043. +     .     : '\(.\)' 2>/dev/null ||
  7044. +echo X/"$0" |
  7045. +    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
  7046. +        /^X\/\(\/\/\)$/{ s//\1/; q; }
  7047. +        /^X\/\(\/\).*/{ s//\1/; q; }
  7048. +        s/.*/./; q'`
  7049. +
  7050. +
  7051. +# PATH needs CR, and LINENO needs CR and PATH.
  7052. +# Avoid depending upon Character Ranges.
  7053. +as_cr_letters='abcdefghijklmnopqrstuvwxyz'
  7054. +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  7055. +as_cr_Letters=$as_cr_letters$as_cr_LETTERS
  7056. +as_cr_digits='0123456789'
  7057. +as_cr_alnum=$as_cr_Letters$as_cr_digits
  7058. +
  7059. +# The user is always right.
  7060. +if test "${PATH_SEPARATOR+set}" != set; then
  7061. +  echo "#! /bin/sh" >conf$$.sh
  7062. +  echo  "exit 0"   >>conf$$.sh
  7063. +  chmod +x conf$$.sh
  7064. +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
  7065. +    PATH_SEPARATOR=';'
  7066. +  else
  7067. +    PATH_SEPARATOR=:
  7068. +  fi
  7069. +  rm -f conf$$.sh
  7070. +fi
  7071. +
  7072. +
  7073. +  as_lineno_1=$LINENO
  7074. +  as_lineno_2=$LINENO
  7075. +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  7076. +  test "x$as_lineno_1" != "x$as_lineno_2" &&
  7077. +  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
  7078. +  # Find who we are.  Look in the path if we contain no path at all
  7079. +  # relative or not.
  7080. +  case $0 in
  7081. +    *[\\/]* ) as_myself=$0 ;;
  7082. +    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  7083. +for as_dir in $PATH
  7084. +do
  7085. +  IFS=$as_save_IFS
  7086. +  test -z "$as_dir" && as_dir=.
  7087. +  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
  7088. +done
  7089. +
  7090. +       ;;
  7091. +  esac
  7092. +  # We did not find ourselves, most probably we were run as `sh COMMAND'
  7093. +  # in which case we are not to be found in the path.
  7094. +  if test "x$as_myself" = x; then
  7095. +    as_myself=$0
  7096. +  fi
  7097. +  if test ! -f "$as_myself"; then
  7098. +    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
  7099. +   { (exit 1); exit 1; }; }
  7100. +  fi
  7101. +  case $CONFIG_SHELL in
  7102. +  '')
  7103. +    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  7104. +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
  7105. +do
  7106. +  IFS=$as_save_IFS
  7107. +  test -z "$as_dir" && as_dir=.
  7108. +  for as_base in sh bash ksh sh5; do
  7109. +     case $as_dir in
  7110. +     /*)
  7111. +       if ("$as_dir/$as_base" -c '
  7112. +  as_lineno_1=$LINENO
  7113. +  as_lineno_2=$LINENO
  7114. +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  7115. +  test "x$as_lineno_1" != "x$as_lineno_2" &&
  7116. +  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
  7117. +         $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
  7118. +         $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
  7119. +         CONFIG_SHELL=$as_dir/$as_base
  7120. +         export CONFIG_SHELL
  7121. +         exec "$CONFIG_SHELL" "$0" ${1+"$@"}
  7122. +       fi;;
  7123. +     esac
  7124. +       done
  7125. +done
  7126. +;;
  7127. +  esac
  7128. +
  7129. +  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
  7130. +  # uniformly replaced by the line number.  The first 'sed' inserts a
  7131. +  # line-number line before each line; the second 'sed' does the real
  7132. +  # work.  The second script uses 'N' to pair each line-number line
  7133. +  # with the numbered line, and appends trailing '-' during
  7134. +  # substitution so that $LINENO is not a special case at line end.
  7135. +  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
  7136. +  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
  7137. +  sed '=' <$as_myself |
  7138. +    sed '
  7139. +      N
  7140. +      s,$,-,
  7141. +      : loop
  7142. +      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
  7143. +      t loop
  7144. +      s,-$,,
  7145. +      s,^['$as_cr_digits']*\n,,
  7146. +    ' >$as_me.lineno &&
  7147. +  chmod +x $as_me.lineno ||
  7148. +    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
  7149. +   { (exit 1); exit 1; }; }
  7150. +
  7151. +  # Don't try to exec as it changes $[0], causing all sort of problems
  7152. +  # (the dirname of $[0] is not the place where we might find the
  7153. +  # original and so on.  Autoconf is especially sensible to this).
  7154. +  . ./$as_me.lineno
  7155. +  # Exit status is that of the last command.
  7156. +  exit
  7157. +}
  7158. +
  7159. +
  7160. +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
  7161. +  *c*,-n*) ECHO_N= ECHO_C='
  7162. +' ECHO_T='    ' ;;
  7163. +  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
  7164. +  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
  7165. +esac
  7166. +
  7167. +if expr a : '\(a\)' >/dev/null 2>&1; then
  7168. +  as_expr=expr
  7169. +else
  7170. +  as_expr=false
  7171. +fi
  7172. +
  7173. +rm -f conf$$ conf$$.exe conf$$.file
  7174. +echo >conf$$.file
  7175. +if ln -s conf$$.file conf$$ 2>/dev/null; then
  7176. +  # We could just check for DJGPP; but this test a) works b) is more generic
  7177. +  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
  7178. +  if test -f conf$$.exe; then
  7179. +    # Don't use ln at all; we don't have any links
  7180. +    as_ln_s='cp -p'
  7181. +  else
  7182. +    as_ln_s='ln -s'
  7183. +  fi
  7184. +elif ln conf$$.file conf$$ 2>/dev/null; then
  7185. +  as_ln_s=ln
  7186. +else
  7187. +  as_ln_s='cp -p'
  7188. +fi
  7189. +rm -f conf$$ conf$$.exe conf$$.file
  7190. +
  7191. +if mkdir -p . 2>/dev/null; then
  7192. +  as_mkdir_p=:
  7193. +else
  7194. +  as_mkdir_p=false
  7195. +fi
  7196. +
  7197. +as_executable_p="test -f"
  7198. +
  7199. +# Sed expression to map a string onto a valid CPP name.
  7200. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
  7201. +
  7202. +# Sed expression to map a string onto a valid variable name.
  7203. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
  7204. +
  7205.  
  7206. -# Defaults:
  7207. -ac_help=
  7208. +# IFS
  7209. +# We need space, tab and new line, in precisely that order.
  7210. +as_nl='
  7211. +'
  7212. +IFS="     $as_nl"
  7213. +
  7214. +# CDPATH.
  7215. +$as_unset CDPATH
  7216. +
  7217. +
  7218. +# Name of the host.
  7219. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
  7220. +# so uname gets run too.
  7221. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
  7222. +
  7223. +exec 6>&1
  7224. +
  7225. +#
  7226. +# Initializations.
  7227. +#
  7228.  ac_default_prefix=/usr/local
  7229. -# Any additions from configure.in:
  7230. -ac_help="$ac_help
  7231. -  --enable-shared[=PKGS]  build shared libraries [default=no]"
  7232. -ac_help="$ac_help
  7233. -  --enable-static[=PKGS]  build static libraries [default=yes]"
  7234. -ac_help="$ac_help
  7235. -  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
  7236. -ac_help="$ac_help
  7237. -  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
  7238. -ac_help="$ac_help
  7239. -  --disable-libtool-lock  avoid locking (might break parallel builds)"
  7240. -ac_help="$ac_help
  7241. -  --with-pic              try to use only PIC/non-PIC objects [default=use both]"
  7242. -ac_help="$ac_help
  7243. -  --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)"
  7244. -ac_help="$ac_help
  7245. -  --enable-targets        alternative target configurations"
  7246. -ac_help="$ac_help
  7247. -  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library"
  7248. -ac_help="$ac_help
  7249. -  --with-mmap             try using mmap for BFD input files if available"
  7250. -ac_help="$ac_help
  7251. -  --enable-build-warnings Enable build-time compiler warnings if gcc is used"
  7252. -ac_help="$ac_help
  7253. -  --enable-maintainer-mode enable make rules and dependencies not useful
  7254. -                          (and sometimes confusing) to the casual installer"
  7255. -ac_help="$ac_help
  7256. -  --enable-install-libbfd controls installation of libbfd and related headers"
  7257. -ac_help="$ac_help
  7258. -  --disable-nls           do not use Native Language Support"
  7259. -ac_help="$ac_help
  7260. -  --with-included-gettext use the GNU gettext library included here"
  7261. +ac_config_libobj_dir=.
  7262. +cross_compiling=no
  7263. +subdirs=
  7264. +MFLAGS=
  7265. +MAKEFLAGS=
  7266. +SHELL=${CONFIG_SHELL-/bin/sh}
  7267. +
  7268. +# Maximum number of lines to put in a shell here document.
  7269. +# This variable seems obsolete.  It should probably be removed, and
  7270. +# only ac_max_sed_lines should be used.
  7271. +: ${ac_max_here_lines=38}
  7272. +
  7273. +# Identity of this package.
  7274. +PACKAGE_NAME=
  7275. +PACKAGE_TARNAME=
  7276. +PACKAGE_VERSION=
  7277. +PACKAGE_STRING=
  7278. +PACKAGE_BUGREPORT=
  7279. +
  7280. +ac_unique_file="libbfd.c"
  7281. +# Factoring default headers for most tests.
  7282. +ac_includes_default="\
  7283. +#include <stdio.h>
  7284. +#if HAVE_SYS_TYPES_H
  7285. +# include <sys/types.h>
  7286. +#endif
  7287. +#if HAVE_SYS_STAT_H
  7288. +# include <sys/stat.h>
  7289. +#endif
  7290. +#if STDC_HEADERS
  7291. +# include <stdlib.h>
  7292. +# include <stddef.h>
  7293. +#else
  7294. +# if HAVE_STDLIB_H
  7295. +#  include <stdlib.h>
  7296. +# endif
  7297. +#endif
  7298. +#if HAVE_STRING_H
  7299. +# if !STDC_HEADERS && HAVE_MEMORY_H
  7300. +#  include <memory.h>
  7301. +# endif
  7302. +# include <string.h>
  7303. +#endif
  7304. +#if HAVE_STRINGS_H
  7305. +# include <strings.h>
  7306. +#endif
  7307. +#if HAVE_INTTYPES_H
  7308. +# include <inttypes.h>
  7309. +#else
  7310. +# if HAVE_STDINT_H
  7311. +#  include <stdint.h>
  7312. +# endif
  7313. +#endif
  7314. +#if HAVE_UNISTD_H
  7315. +# include <unistd.h>
  7316. +#endif"
  7317. +
  7318. +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE bfd_version bfd_version_string AR ac_ct_AR RANLIB ac_ct_RANLIB LN_S LIBTOOL WARN_CFLAGS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE bfdlibdir bfdincludedir CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd_libs all_backends bfd_backends bfd_machines bfd_default_target_size tdefaults LIBOBJS LTLIBOBJS'
  7319. +ac_subst_files=''
  7320.  
  7321.  # Initialize some variables set by options.
  7322. +ac_init_help=
  7323. +ac_init_version=false
  7324.  # The variables have the same names as the options, with
  7325.  # dashes changed to underlines.
  7326. -build=NONE
  7327. -cache_file=./config.cache
  7328. +cache_file=/dev/null
  7329.  exec_prefix=NONE
  7330. -host=NONE
  7331.  no_create=
  7332. -nonopt=NONE
  7333.  no_recursion=
  7334.  prefix=NONE
  7335.  program_prefix=NONE
  7336. @@ -59,12 +326,16 @@
  7337.  program_transform_name=s,x,x,
  7338.  silent=
  7339.  site=
  7340. -sitefile=
  7341.  srcdir=
  7342. -target=NONE
  7343.  verbose=
  7344.  x_includes=NONE
  7345.  x_libraries=NONE
  7346. +
  7347. +# Installation directory options.
  7348. +# These are left unexpanded so users can "make install exec_prefix=/foo"
  7349. +# and all the variables that are supposed to be based on exec_prefix
  7350. +# by default will actually change.
  7351. +# Use braces instead of parens because sh, perl, etc. also accept them.
  7352.  bindir='${exec_prefix}/bin'
  7353.  sbindir='${exec_prefix}/sbin'
  7354.  libexecdir='${exec_prefix}/libexec'
  7355. @@ -78,13 +349,6 @@
  7356.  infodir='${prefix}/info'
  7357.  mandir='${prefix}/man'
  7358.  
  7359. -# Initialize some other variables.
  7360. -subdirs=
  7361. -MFLAGS= MAKEFLAGS=
  7362. -SHELL=${CONFIG_SHELL-/bin/sh}
  7363. -# Maximum number of lines to put in a shell here document.
  7364. -ac_max_here_lines=12
  7365. -
  7366.  ac_prev=
  7367.  for ac_option
  7368.  do
  7369. @@ -96,59 +360,59 @@
  7370.      continue
  7371.    fi
  7372.  
  7373. -  case "$ac_option" in
  7374. -  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  7375. -  *) ac_optarg= ;;
  7376. -  esac
  7377. +  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
  7378.  
  7379.    # Accept the important Cygnus configure options, so we can diagnose typos.
  7380.  
  7381. -  case "$ac_option" in
  7382. +  case $ac_option in
  7383.  
  7384.    -bindir | --bindir | --bindi | --bind | --bin | --bi)
  7385.      ac_prev=bindir ;;
  7386.    -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
  7387. -    bindir="$ac_optarg" ;;
  7388. +    bindir=$ac_optarg ;;
  7389.  
  7390.    -build | --build | --buil | --bui | --bu)
  7391. -    ac_prev=build ;;
  7392. +    ac_prev=build_alias ;;
  7393.    -build=* | --build=* | --buil=* | --bui=* | --bu=*)
  7394. -    build="$ac_optarg" ;;
  7395. +    build_alias=$ac_optarg ;;
  7396.  
  7397.    -cache-file | --cache-file | --cache-fil | --cache-fi \
  7398.    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
  7399.      ac_prev=cache_file ;;
  7400.    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  7401.    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
  7402. -    cache_file="$ac_optarg" ;;
  7403. +    cache_file=$ac_optarg ;;
  7404. +
  7405. +  --config-cache | -C)
  7406. +    cache_file=config.cache ;;
  7407.  
  7408.    -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
  7409.      ac_prev=datadir ;;
  7410.    -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
  7411.    | --da=*)
  7412. -    datadir="$ac_optarg" ;;
  7413. +    datadir=$ac_optarg ;;
  7414.  
  7415.    -disable-* | --disable-*)
  7416. -    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
  7417. +    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
  7418.      # Reject names that are not valid shell variable names.
  7419. -    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
  7420. -      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  7421. -    fi
  7422. -    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
  7423. -    eval "enable_${ac_feature}=no" ;;
  7424. +    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
  7425. +      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
  7426. +   { (exit 1); exit 1; }; }
  7427. +    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
  7428. +    eval "enable_$ac_feature=no" ;;
  7429.  
  7430.    -enable-* | --enable-*)
  7431. -    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
  7432. +    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
  7433.      # Reject names that are not valid shell variable names.
  7434. -    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
  7435. -      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  7436. -    fi
  7437. -    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
  7438. -    case "$ac_option" in
  7439. -      *=*) ;;
  7440. +    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
  7441. +      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
  7442. +   { (exit 1); exit 1; }; }
  7443. +    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
  7444. +    case $ac_option in
  7445. +      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
  7446.        *) ac_optarg=yes ;;
  7447.      esac
  7448. -    eval "enable_${ac_feature}='$ac_optarg'" ;;
  7449. +    eval "enable_$ac_feature='$ac_optarg'" ;;
  7450.  
  7451.    -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  7452.    | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  7453. @@ -157,96 +421,47 @@
  7454.    -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  7455.    | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  7456.    | --exec=* | --exe=* | --ex=*)
  7457. -    exec_prefix="$ac_optarg" ;;
  7458. +    exec_prefix=$ac_optarg ;;
  7459.  
  7460.    -gas | --gas | --ga | --g)
  7461.      # Obsolete; use --with-gas.
  7462.      with_gas=yes ;;
  7463.  
  7464. -  -help | --help | --hel | --he)
  7465. -    # Omit some internal or obsolete options to make the list less imposing.
  7466. -    # This message is too long to be a string in the A/UX 3.1 sh.
  7467. -    cat << EOF
  7468. -Usage: configure [options] [host]
  7469. -Options: [defaults in brackets after descriptions]
  7470. -Configuration:
  7471. -  --cache-file=FILE       cache test results in FILE
  7472. -  --help                  print this message
  7473. -  --no-create             do not create output files
  7474. -  --quiet, --silent       do not print \`checking...' messages
  7475. -  --site-file=FILE        use FILE as the site file
  7476. -  --version               print the version of autoconf that created configure
  7477. -Directory and file names:
  7478. -  --prefix=PREFIX         install architecture-independent files in PREFIX
  7479. -                          [$ac_default_prefix]
  7480. -  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
  7481. -                          [same as prefix]
  7482. -  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  7483. -  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
  7484. -  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
  7485. -  --datadir=DIR           read-only architecture-independent data in DIR
  7486. -                          [PREFIX/share]
  7487. -  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  7488. -  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
  7489. -                          [PREFIX/com]
  7490. -  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
  7491. -  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
  7492. -  --includedir=DIR        C header files in DIR [PREFIX/include]
  7493. -  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
  7494. -  --infodir=DIR           info documentation in DIR [PREFIX/info]
  7495. -  --mandir=DIR            man documentation in DIR [PREFIX/man]
  7496. -  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  7497. -  --program-prefix=PREFIX prepend PREFIX to installed program names
  7498. -  --program-suffix=SUFFIX append SUFFIX to installed program names
  7499. -  --program-transform-name=PROGRAM
  7500. -                          run sed PROGRAM on installed program names
  7501. -EOF
  7502. -    cat << EOF
  7503. -Host type:
  7504. -  --build=BUILD           configure for building on BUILD [BUILD=HOST]
  7505. -  --host=HOST             configure for HOST [guessed]
  7506. -  --target=TARGET         configure for TARGET [TARGET=HOST]
  7507. -Features and packages:
  7508. -  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  7509. -  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  7510. -  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  7511. -  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  7512. -  --x-includes=DIR        X include files are in DIR
  7513. -  --x-libraries=DIR       X library files are in DIR
  7514. -EOF
  7515. -    if test -n "$ac_help"; then
  7516. -      echo "--enable and --with options recognized:$ac_help"
  7517. -    fi
  7518. -    exit 0 ;;
  7519. +  -help | --help | --hel | --he | -h)
  7520. +    ac_init_help=long ;;
  7521. +  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
  7522. +    ac_init_help=recursive ;;
  7523. +  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
  7524. +    ac_init_help=short ;;
  7525.  
  7526.    -host | --host | --hos | --ho)
  7527. -    ac_prev=host ;;
  7528. +    ac_prev=host_alias ;;
  7529.    -host=* | --host=* | --hos=* | --ho=*)
  7530. -    host="$ac_optarg" ;;
  7531. +    host_alias=$ac_optarg ;;
  7532.  
  7533.    -includedir | --includedir | --includedi | --included | --include \
  7534.    | --includ | --inclu | --incl | --inc)
  7535.      ac_prev=includedir ;;
  7536.    -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
  7537.    | --includ=* | --inclu=* | --incl=* | --inc=*)
  7538. -    includedir="$ac_optarg" ;;
  7539. +    includedir=$ac_optarg ;;
  7540.  
  7541.    -infodir | --infodir | --infodi | --infod | --info | --inf)
  7542.      ac_prev=infodir ;;
  7543.    -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
  7544. -    infodir="$ac_optarg" ;;
  7545. +    infodir=$ac_optarg ;;
  7546.  
  7547.    -libdir | --libdir | --libdi | --libd)
  7548.      ac_prev=libdir ;;
  7549.    -libdir=* | --libdir=* | --libdi=* | --libd=*)
  7550. -    libdir="$ac_optarg" ;;
  7551. +    libdir=$ac_optarg ;;
  7552.  
  7553.    -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
  7554.    | --libexe | --libex | --libe)
  7555.      ac_prev=libexecdir ;;
  7556.    -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
  7557.    | --libexe=* | --libex=* | --libe=*)
  7558. -    libexecdir="$ac_optarg" ;;
  7559. +    libexecdir=$ac_optarg ;;
  7560.  
  7561.    -localstatedir | --localstatedir | --localstatedi | --localstated \
  7562.    | --localstate | --localstat | --localsta | --localst \
  7563. @@ -255,19 +470,19 @@
  7564.    -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
  7565.    | --localstate=* | --localstat=* | --localsta=* | --localst=* \
  7566.    | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
  7567. -    localstatedir="$ac_optarg" ;;
  7568. +    localstatedir=$ac_optarg ;;
  7569.  
  7570.    -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
  7571.      ac_prev=mandir ;;
  7572.    -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
  7573. -    mandir="$ac_optarg" ;;
  7574. +    mandir=$ac_optarg ;;
  7575.  
  7576.    -nfp | --nfp | --nf)
  7577.      # Obsolete; use --without-fp.
  7578.      with_fp=no ;;
  7579.  
  7580.    -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  7581. -  | --no-cr | --no-c)
  7582. +  | --no-cr | --no-c | -n)
  7583.      no_create=yes ;;
  7584.  
  7585.    -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  7586. @@ -281,26 +496,26 @@
  7587.    -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
  7588.    | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
  7589.    | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
  7590. -    oldincludedir="$ac_optarg" ;;
  7591. +    oldincludedir=$ac_optarg ;;
  7592.  
  7593.    -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  7594.      ac_prev=prefix ;;
  7595.    -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  7596. -    prefix="$ac_optarg" ;;
  7597. +    prefix=$ac_optarg ;;
  7598.  
  7599.    -program-prefix | --program-prefix | --program-prefi | --program-pref \
  7600.    | --program-pre | --program-pr | --program-p)
  7601.      ac_prev=program_prefix ;;
  7602.    -program-prefix=* | --program-prefix=* | --program-prefi=* \
  7603.    | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
  7604. -    program_prefix="$ac_optarg" ;;
  7605. +    program_prefix=$ac_optarg ;;
  7606.  
  7607.    -program-suffix | --program-suffix | --program-suffi | --program-suff \
  7608.    | --program-suf | --program-su | --program-s)
  7609.      ac_prev=program_suffix ;;
  7610.    -program-suffix=* | --program-suffix=* | --program-suffi=* \
  7611.    | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
  7612. -    program_suffix="$ac_optarg" ;;
  7613. +    program_suffix=$ac_optarg ;;
  7614.  
  7615.    -program-transform-name | --program-transform-name \
  7616.    | --program-transform-nam | --program-transform-na \
  7617. @@ -317,7 +532,7 @@
  7618.    | --program-transfo=* | --program-transf=* \
  7619.    | --program-trans=* | --program-tran=* \
  7620.    | --progr-tra=* | --program-tr=* | --program-t=*)
  7621. -    program_transform_name="$ac_optarg" ;;
  7622. +    program_transform_name=$ac_optarg ;;
  7623.  
  7624.    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  7625.    | -silent | --silent | --silen | --sile | --sil)
  7626. @@ -327,7 +542,7 @@
  7627.      ac_prev=sbindir ;;
  7628.    -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  7629.    | --sbi=* | --sb=*)
  7630. -    sbindir="$ac_optarg" ;;
  7631. +    sbindir=$ac_optarg ;;
  7632.  
  7633.    -sharedstatedir | --sharedstatedir | --sharedstatedi \
  7634.    | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
  7635. @@ -338,63 +553,57 @@
  7636.    | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
  7637.    | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
  7638.    | --sha=* | --sh=*)
  7639. -    sharedstatedir="$ac_optarg" ;;
  7640. +    sharedstatedir=$ac_optarg ;;
  7641.  
  7642.    -site | --site | --sit)
  7643.      ac_prev=site ;;
  7644.    -site=* | --site=* | --sit=*)
  7645. -    site="$ac_optarg" ;;
  7646. -
  7647. -  -site-file | --site-file | --site-fil | --site-fi | --site-f)
  7648. -    ac_prev=sitefile ;;
  7649. -  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
  7650. -    sitefile="$ac_optarg" ;;
  7651. +    site=$ac_optarg ;;
  7652.  
  7653.    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  7654.      ac_prev=srcdir ;;
  7655.    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  7656. -    srcdir="$ac_optarg" ;;
  7657. +    srcdir=$ac_optarg ;;
  7658.  
  7659.    -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
  7660.    | --syscon | --sysco | --sysc | --sys | --sy)
  7661.      ac_prev=sysconfdir ;;
  7662.    -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
  7663.    | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
  7664. -    sysconfdir="$ac_optarg" ;;
  7665. +    sysconfdir=$ac_optarg ;;
  7666.  
  7667.    -target | --target | --targe | --targ | --tar | --ta | --t)
  7668. -    ac_prev=target ;;
  7669. +    ac_prev=target_alias ;;
  7670.    -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
  7671. -    target="$ac_optarg" ;;
  7672. +    target_alias=$ac_optarg ;;
  7673.  
  7674.    -v | -verbose | --verbose | --verbos | --verbo | --verb)
  7675.      verbose=yes ;;
  7676.  
  7677. -  -version | --version | --versio | --versi | --vers)
  7678. -    echo "configure generated by autoconf version 2.13"
  7679. -    exit 0 ;;
  7680. +  -version | --version | --versio | --versi | --vers | -V)
  7681. +    ac_init_version=: ;;
  7682.  
  7683.    -with-* | --with-*)
  7684. -    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
  7685. +    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
  7686.      # Reject names that are not valid shell variable names.
  7687. -    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
  7688. -      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  7689. -    fi
  7690. +    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
  7691. +      { echo "$as_me: error: invalid package name: $ac_package" >&2
  7692. +   { (exit 1); exit 1; }; }
  7693.      ac_package=`echo $ac_package| sed 's/-/_/g'`
  7694. -    case "$ac_option" in
  7695. -      *=*) ;;
  7696. +    case $ac_option in
  7697. +      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
  7698.        *) ac_optarg=yes ;;
  7699.      esac
  7700. -    eval "with_${ac_package}='$ac_optarg'" ;;
  7701. +    eval "with_$ac_package='$ac_optarg'" ;;
  7702.  
  7703.    -without-* | --without-*)
  7704. -    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
  7705. +    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
  7706.      # Reject names that are not valid shell variable names.
  7707. -    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  7708. -      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  7709. -    fi
  7710. -    ac_package=`echo $ac_package| sed 's/-/_/g'`
  7711. -    eval "with_${ac_package}=no" ;;
  7712. +    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
  7713. +      { echo "$as_me: error: invalid package name: $ac_package" >&2
  7714. +   { (exit 1); exit 1; }; }
  7715. +    ac_package=`echo $ac_package | sed 's/-/_/g'`
  7716. +    eval "with_$ac_package=no" ;;
  7717.  
  7718.    --x)
  7719.      # Obsolete; use --with-x.
  7720. @@ -405,99 +614,110 @@
  7721.      ac_prev=x_includes ;;
  7722.    -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  7723.    | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
  7724. -    x_includes="$ac_optarg" ;;
  7725. +    x_includes=$ac_optarg ;;
  7726.  
  7727.    -x-libraries | --x-libraries | --x-librarie | --x-librari \
  7728.    | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
  7729.      ac_prev=x_libraries ;;
  7730.    -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  7731.    | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
  7732. -    x_libraries="$ac_optarg" ;;
  7733. +    x_libraries=$ac_optarg ;;
  7734.  
  7735. -  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
  7736. +  -*) { echo "$as_me: error: unrecognized option: $ac_option
  7737. +Try \`$0 --help' for more information." >&2
  7738. +   { (exit 1); exit 1; }; }
  7739.      ;;
  7740.  
  7741. +  *=*)
  7742. +    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
  7743. +    # Reject names that are not valid shell variable names.
  7744. +    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
  7745. +      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
  7746. +   { (exit 1); exit 1; }; }
  7747. +    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
  7748. +    eval "$ac_envvar='$ac_optarg'"
  7749. +    export $ac_envvar ;;
  7750. +
  7751.    *)
  7752. -    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
  7753. -      echo "configure: warning: $ac_option: invalid host type" 1>&2
  7754. -    fi
  7755. -    if test "x$nonopt" != xNONE; then
  7756. -      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
  7757. -    fi
  7758. -    nonopt="$ac_option"
  7759. +    # FIXME: should be removed in autoconf 3.0.
  7760. +    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
  7761. +    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
  7762. +      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
  7763. +    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
  7764.      ;;
  7765.  
  7766.    esac
  7767.  done
  7768.  
  7769.  if test -n "$ac_prev"; then
  7770. -  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
  7771. -fi
  7772. -
  7773. -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
  7774. -
  7775. -# File descriptor usage:
  7776. -# 0 standard input
  7777. -# 1 file creation
  7778. -# 2 errors and warnings
  7779. -# 3 some systems may open it to /dev/tty
  7780. -# 4 used on the Kubota Titan
  7781. -# 6 checking for... messages and results
  7782. -# 5 compiler messages saved in config.log
  7783. -if test "$silent" = yes; then
  7784. -  exec 6>/dev/null
  7785. -else
  7786. -  exec 6>&1
  7787. +  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
  7788. +  { echo "$as_me: error: missing argument to $ac_option" >&2
  7789. +   { (exit 1); exit 1; }; }
  7790.  fi
  7791. -exec 5>./config.log
  7792.  
  7793. -echo "\
  7794. -This file contains any messages produced by compilers while
  7795. -running configure, to aid debugging if configure makes a mistake.
  7796. -" 1>&5
  7797. +# Be sure to have absolute paths.
  7798. +for ac_var in exec_prefix prefix
  7799. +do
  7800. +  eval ac_val=$`echo $ac_var`
  7801. +  case $ac_val in
  7802. +    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
  7803. +    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
  7804. +   { (exit 1); exit 1; }; };;
  7805. +  esac
  7806. +done
  7807.  
  7808. -# Strip out --no-create and --no-recursion so they do not pile up.
  7809. -# Also quote any args containing shell metacharacters.
  7810. -ac_configure_args=
  7811. -for ac_arg
  7812. +# Be sure to have absolute paths.
  7813. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
  7814. +              localstatedir libdir includedir oldincludedir infodir mandir
  7815.  do
  7816. -  case "$ac_arg" in
  7817. -  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  7818. -  | --no-cr | --no-c) ;;
  7819. -  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  7820. -  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
  7821. -  *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
  7822. -  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
  7823. -  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
  7824. +  eval ac_val=$`echo $ac_var`
  7825. +  case $ac_val in
  7826. +    [\\/$]* | ?:[\\/]* ) ;;
  7827. +    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
  7828. +   { (exit 1); exit 1; }; };;
  7829.    esac
  7830.  done
  7831.  
  7832. -# NLS nuisances.
  7833. -# Only set these to C if already set.  These must not be set unconditionally
  7834. -# because not all systems understand e.g. LANG=C (notably SCO).
  7835. -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
  7836. -# Non-C LC_CTYPE values break the ctype check.
  7837. -if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
  7838. -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
  7839. -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
  7840. -if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
  7841. +# There might be people who depend on the old broken behavior: `$host'
  7842. +# used to hold the argument of --host etc.
  7843. +# FIXME: To remove some day.
  7844. +build=$build_alias
  7845. +host=$host_alias
  7846. +target=$target_alias
  7847. +
  7848. +# FIXME: To remove some day.
  7849. +if test "x$host_alias" != x; then
  7850. +  if test "x$build_alias" = x; then
  7851. +    cross_compiling=maybe
  7852. +    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
  7853. +    If a cross compiler is detected then cross compile mode will be used." >&2
  7854. +  elif test "x$build_alias" != "x$host_alias"; then
  7855. +    cross_compiling=yes
  7856. +  fi
  7857. +fi
  7858.  
  7859. -# confdefs.h avoids OS command line length limits that DEFS can exceed.
  7860. -rm -rf conftest* confdefs.h
  7861. -# AIX cpp loses on an empty file, so make sure it contains at least a newline.
  7862. -echo > confdefs.h
  7863. +ac_tool_prefix=
  7864. +test -n "$host_alias" && ac_tool_prefix=$host_alias-
  7865. +
  7866. +test "$silent" = yes && exec 6>/dev/null
  7867.  
  7868. -# A filename unique to this package, relative to the directory that
  7869. -# configure is in, which we can look for to find out if srcdir is correct.
  7870. -ac_unique_file=libbfd.c
  7871.  
  7872.  # Find the source files, if location was not specified.
  7873.  if test -z "$srcdir"; then
  7874.    ac_srcdir_defaulted=yes
  7875.    # Try the directory containing this script, then its parent.
  7876. -  ac_prog=$0
  7877. -  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  7878. -  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  7879. +  ac_confdir=`(dirname "$0") 2>/dev/null ||
  7880. +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  7881. +         X"$0" : 'X\(//\)[^/]' \| \
  7882. +         X"$0" : 'X\(//\)$' \| \
  7883. +         X"$0" : 'X\(/\)' \| \
  7884. +         .     : '\(.\)' 2>/dev/null ||
  7885. +echo X"$0" |
  7886. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  7887. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  7888. +        /^X\(\/\/\)$/{ s//\1/; q; }
  7889. +        /^X\(\/\).*/{ s//\1/; q; }
  7890. +        s/.*/./; q'`
  7891.    srcdir=$ac_confdir
  7892.    if test ! -r $srcdir/$ac_unique_file; then
  7893.      srcdir=..
  7894. @@ -507,920 +727,2343 @@
  7895.  fi
  7896.  if test ! -r $srcdir/$ac_unique_file; then
  7897.    if test "$ac_srcdir_defaulted" = yes; then
  7898. -    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
  7899. +    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
  7900. +   { (exit 1); exit 1; }; }
  7901.    else
  7902. -    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  7903. +    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
  7904. +   { (exit 1); exit 1; }; }
  7905.    fi
  7906.  fi
  7907. -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
  7908. +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
  7909. +  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
  7910. +   { (exit 1); exit 1; }; }
  7911. +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
  7912. +ac_env_build_alias_set=${build_alias+set}
  7913. +ac_env_build_alias_value=$build_alias
  7914. +ac_cv_env_build_alias_set=${build_alias+set}
  7915. +ac_cv_env_build_alias_value=$build_alias
  7916. +ac_env_host_alias_set=${host_alias+set}
  7917. +ac_env_host_alias_value=$host_alias
  7918. +ac_cv_env_host_alias_set=${host_alias+set}
  7919. +ac_cv_env_host_alias_value=$host_alias
  7920. +ac_env_target_alias_set=${target_alias+set}
  7921. +ac_env_target_alias_value=$target_alias
  7922. +ac_cv_env_target_alias_set=${target_alias+set}
  7923. +ac_cv_env_target_alias_value=$target_alias
  7924. +ac_env_CC_set=${CC+set}
  7925. +ac_env_CC_value=$CC
  7926. +ac_cv_env_CC_set=${CC+set}
  7927. +ac_cv_env_CC_value=$CC
  7928. +ac_env_CFLAGS_set=${CFLAGS+set}
  7929. +ac_env_CFLAGS_value=$CFLAGS
  7930. +ac_cv_env_CFLAGS_set=${CFLAGS+set}
  7931. +ac_cv_env_CFLAGS_value=$CFLAGS
  7932. +ac_env_LDFLAGS_set=${LDFLAGS+set}
  7933. +ac_env_LDFLAGS_value=$LDFLAGS
  7934. +ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
  7935. +ac_cv_env_LDFLAGS_value=$LDFLAGS
  7936. +ac_env_CPPFLAGS_set=${CPPFLAGS+set}
  7937. +ac_env_CPPFLAGS_value=$CPPFLAGS
  7938. +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
  7939. +ac_cv_env_CPPFLAGS_value=$CPPFLAGS
  7940. +ac_env_CPP_set=${CPP+set}
  7941. +ac_env_CPP_value=$CPP
  7942. +ac_cv_env_CPP_set=${CPP+set}
  7943. +ac_cv_env_CPP_value=$CPP
  7944.  
  7945. -# Prefer explicitly selected file to automatically selected ones.
  7946. -if test -z "$sitefile"; then
  7947. -  if test -z "$CONFIG_SITE"; then
  7948. -    if test "x$prefix" != xNONE; then
  7949. -      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
  7950. -    else
  7951. -      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
  7952. -    fi
  7953. -  fi
  7954. -else
  7955. -  CONFIG_SITE="$sitefile"
  7956. -fi
  7957. -for ac_site_file in $CONFIG_SITE; do
  7958. -  if test -r "$ac_site_file"; then
  7959. -    echo "loading site script $ac_site_file"
  7960. -    . "$ac_site_file"
  7961. -  fi
  7962. -done
  7963. +#
  7964. +# Report the --help message.
  7965. +#
  7966. +if test "$ac_init_help" = "long"; then
  7967. +  # Omit some internal or obsolete options to make the list less imposing.
  7968. +  # This message is too long to be a string in the A/UX 3.1 sh.
  7969. +  cat <<_ACEOF
  7970. +\`configure' configures this package to adapt to many kinds of systems.
  7971.  
  7972. -if test -r "$cache_file"; then
  7973. -  echo "loading cache $cache_file"
  7974. -  . $cache_file
  7975. -else
  7976. -  echo "creating cache $cache_file"
  7977. -  > $cache_file
  7978. -fi
  7979. +Usage: $0 [OPTION]... [VAR=VALUE]...
  7980.  
  7981. -ac_ext=c
  7982. -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  7983. -ac_cpp='$CPP $CPPFLAGS'
  7984. -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  7985. -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  7986. -cross_compiling=$ac_cv_prog_cc_cross
  7987. +To assign environment variables (e.g., CC, CFLAGS...), specify them as
  7988. +VAR=VALUE.  See below for descriptions of some of the useful variables.
  7989.  
  7990. -ac_exeext=
  7991. -ac_objext=o
  7992. -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  7993. -  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  7994. -  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
  7995. -    ac_n= ac_c='
  7996. -' ac_t='    '
  7997. -  else
  7998. -    ac_n=-n ac_c= ac_t=
  7999. -  fi
  8000. -else
  8001. -  ac_n= ac_c='\c' ac_t=
  8002. -fi
  8003. +Defaults for the options are specified in brackets.
  8004.  
  8005. -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
  8006. -echo "configure:567: checking for Cygwin environment" >&5
  8007. -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
  8008. -  echo $ac_n "(cached) $ac_c" 1>&6
  8009. -else
  8010. -  cat > conftest.$ac_ext <<EOF
  8011. -#line 572 "configure"
  8012. -#include "confdefs.h"
  8013. +Configuration:
  8014. +  -h, --help              display this help and exit
  8015. +      --help=short        display options specific to this package
  8016. +      --help=recursive    display the short help of all the included packages
  8017. +  -V, --version           display version information and exit
  8018. +  -q, --quiet, --silent   do not print \`checking...' messages
  8019. +      --cache-file=FILE   cache test results in FILE [disabled]
  8020. +  -C, --config-cache      alias for \`--cache-file=config.cache'
  8021. +  -n, --no-create         do not create output files
  8022. +      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
  8023.  
  8024. -int main() {
  8025. +_ACEOF
  8026.  
  8027. -#ifndef __CYGWIN__
  8028. -#define __CYGWIN__ __CYGWIN32__
  8029. -#endif
  8030. -return __CYGWIN__;
  8031. -; return 0; }
  8032. -EOF
  8033. -if { (eval echo configure:583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  8034. -  rm -rf conftest*
  8035. -  ac_cv_cygwin=yes
  8036. -else
  8037. -  echo "configure: failed program was:" >&5
  8038. -  cat conftest.$ac_ext >&5
  8039. -  rm -rf conftest*
  8040. -  ac_cv_cygwin=no
  8041. -fi
  8042. -rm -f conftest*
  8043. -rm -f conftest*
  8044. -fi
  8045. +  cat <<_ACEOF
  8046. +Installation directories:
  8047. +  --prefix=PREFIX         install architecture-independent files in PREFIX
  8048. +                          [$ac_default_prefix]
  8049. +  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
  8050. +                          [PREFIX]
  8051.  
  8052. -echo "$ac_t""$ac_cv_cygwin" 1>&6
  8053. -CYGWIN=
  8054. -test "$ac_cv_cygwin" = yes && CYGWIN=yes
  8055. -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
  8056. -echo "configure:600: checking for mingw32 environment" >&5
  8057. -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
  8058. -  echo $ac_n "(cached) $ac_c" 1>&6
  8059. -else
  8060. -  cat > conftest.$ac_ext <<EOF
  8061. -#line 605 "configure"
  8062. -#include "confdefs.h"
  8063. -
  8064. -int main() {
  8065. -return __MINGW32__;
  8066. -; return 0; }
  8067. -EOF
  8068. -if { (eval echo configure:612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  8069. -  rm -rf conftest*
  8070. -  ac_cv_mingw32=yes
  8071. -else
  8072. -  echo "configure: failed program was:" >&5
  8073. -  cat conftest.$ac_ext >&5
  8074. -  rm -rf conftest*
  8075. -  ac_cv_mingw32=no
  8076. -fi
  8077. -rm -f conftest*
  8078. -rm -f conftest*
  8079. -fi
  8080. +By default, \`make install' will install all the files in
  8081. +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
  8082. +an installation prefix other than \`$ac_default_prefix' using \`--prefix',
  8083. +for instance \`--prefix=\$HOME'.
  8084. +
  8085. +For better control, use the options below.
  8086. +
  8087. +Fine tuning of the installation directories:
  8088. +  --bindir=DIR           user executables [EPREFIX/bin]
  8089. +  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  8090. +  --libexecdir=DIR       program executables [EPREFIX/libexec]
  8091. +  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  8092. +  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  8093. +  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  8094. +  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  8095. +  --libdir=DIR           object code libraries [EPREFIX/lib]
  8096. +  --includedir=DIR       C header files [PREFIX/include]
  8097. +  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  8098. +  --infodir=DIR          info documentation [PREFIX/info]
  8099. +  --mandir=DIR           man documentation [PREFIX/man]
  8100. +_ACEOF
  8101.  
  8102. -echo "$ac_t""$ac_cv_mingw32" 1>&6
  8103. -MINGW32=
  8104. -test "$ac_cv_mingw32" = yes && MINGW32=yes
  8105. +  cat <<\_ACEOF
  8106.  
  8107. +Program names:
  8108. +  --program-prefix=PREFIX            prepend PREFIX to installed program names
  8109. +  --program-suffix=SUFFIX            append SUFFIX to installed program names
  8110. +  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
  8111.  
  8112. -ac_aux_dir=
  8113. -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
  8114. -  if test -f $ac_dir/install-sh; then
  8115. -    ac_aux_dir=$ac_dir
  8116. -    ac_install_sh="$ac_aux_dir/install-sh -c"
  8117. -    break
  8118. -  elif test -f $ac_dir/install.sh; then
  8119. -    ac_aux_dir=$ac_dir
  8120. -    ac_install_sh="$ac_aux_dir/install.sh -c"
  8121. -    break
  8122. -  fi
  8123. -done
  8124. -if test -z "$ac_aux_dir"; then
  8125. -  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
  8126. +System types:
  8127. +  --build=BUILD     configure for building on BUILD [guessed]
  8128. +  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  8129. +  --target=TARGET   configure for building compilers for TARGET [HOST]
  8130. +_ACEOF
  8131.  fi
  8132. -ac_config_guess=$ac_aux_dir/config.guess
  8133. -ac_config_sub=$ac_aux_dir/config.sub
  8134. -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
  8135.  
  8136. +if test -n "$ac_init_help"; then
  8137.  
  8138. -# Do some error checking and defaulting for the host and target type.
  8139. -# The inputs are:
  8140. -#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
  8141. -#
  8142. -# The rules are:
  8143. -# 1. You are not allowed to specify --host, --target, and nonopt at the
  8144. -#    same time.
  8145. -# 2. Host defaults to nonopt.
  8146. -# 3. If nonopt is not specified, then host defaults to the current host,
  8147. -#    as determined by config.guess.
  8148. -# 4. Target and build default to nonopt.
  8149. -# 5. If nonopt is not specified, then target and build default to host.
  8150. +  cat <<\_ACEOF
  8151.  
  8152. -# The aliases save the names the user supplied, while $host etc.
  8153. -# will get canonicalized.
  8154. -case $host---$target---$nonopt in
  8155. -NONE---*---* | *---NONE---* | *---*---NONE) ;;
  8156. -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
  8157. -esac
  8158. +Optional Features:
  8159. +  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  8160. +  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  8161. +  --disable-dependency-tracking Speeds up one-time builds
  8162. +  --enable-dependency-tracking  Do not reject slow dependency extractors
  8163. +  --enable-shared=PKGS  build shared libraries default=no
  8164. +  --enable-static=PKGS  build static libraries default=yes
  8165. +  --enable-fast-install=PKGS  optimize for fast installation default=yes
  8166. +  --disable-libtool-lock  avoid locking (might break parallel builds)
  8167. +  --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
  8168. +  --enable-targets        alternative target configurations
  8169. +  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library
  8170. +  --enable-build-warnings Enable build-time compiler warnings if gcc is used
  8171. +  --enable-maintainer-mode enable make rules and dependencies not useful
  8172. +                          (and sometimes confusing) to the casual installer
  8173. +  --enable-install-libbfd controls installation of libbfd and related headers
  8174. +  --disable-nls           do not use Native Language Support
  8175.  
  8176. +Optional Packages:
  8177. +  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  8178. +  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  8179. +  --with-gnu-ld           assume the C compiler uses GNU ld default=no
  8180. +  --with-pic              try to use only PIC/non-PIC objects default=use both
  8181. +  --with-mmap             try using mmap for BFD input files if available
  8182. +  --with-included-gettext use the GNU gettext library included here
  8183. +
  8184. +Some influential environment variables:
  8185. +  CC          C compiler command
  8186. +  CFLAGS      C compiler flags
  8187. +  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
  8188. +              nonstandard directory <lib dir>
  8189. +  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
  8190. +              headers in a nonstandard directory <include dir>
  8191. +  CPP         C preprocessor
  8192. +
  8193. +Use these variables to override the choices made by `configure' or to help
  8194. +it to find libraries and programs with nonstandard names/locations.
  8195. +
  8196. +_ACEOF
  8197. +fi
  8198. +
  8199. +if test "$ac_init_help" = "recursive"; then
  8200. +  # If there are subdirs, report their specific --help.
  8201. +  ac_popdir=`pwd`
  8202. +  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
  8203. +    test -d $ac_dir || continue
  8204. +    ac_builddir=.
  8205.  
  8206. -# Make sure we can run config.sub.
  8207. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
  8208. -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
  8209. +if test "$ac_dir" != .; then
  8210. +  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
  8211. +  # A "../" for each directory in $ac_dir_suffix.
  8212. +  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
  8213. +else
  8214. +  ac_dir_suffix= ac_top_builddir=
  8215.  fi
  8216.  
  8217. -echo $ac_n "checking host system type""... $ac_c" 1>&6
  8218. -echo "configure:677: checking host system type" >&5
  8219. -
  8220. -host_alias=$host
  8221. -case "$host_alias" in
  8222. -NONE)
  8223. -  case $nonopt in
  8224. -  NONE)
  8225. -    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
  8226. -    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
  8227. +case $srcdir in
  8228. +  .)  # No --srcdir option.  We are building in place.
  8229. +    ac_srcdir=.
  8230. +    if test -z "$ac_top_builddir"; then
  8231. +       ac_top_srcdir=.
  8232. +    else
  8233. +       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
  8234.      fi ;;
  8235. -  *) host_alias=$nonopt ;;
  8236. -  esac ;;
  8237. +  [\\/]* | ?:[\\/]* )  # Absolute path.
  8238. +    ac_srcdir=$srcdir$ac_dir_suffix;
  8239. +    ac_top_srcdir=$srcdir ;;
  8240. +  *) # Relative path.
  8241. +    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
  8242. +    ac_top_srcdir=$ac_top_builddir$srcdir ;;
  8243.  esac
  8244. +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
  8245. +# absolute.
  8246. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
  8247. +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
  8248. +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
  8249. +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
  8250. +
  8251. +    cd $ac_dir
  8252. +    # Check for guested configure; otherwise get Cygnus style configure.
  8253. +    if test -f $ac_srcdir/configure.gnu; then
  8254. +      echo
  8255. +      $SHELL $ac_srcdir/configure.gnu  --help=recursive
  8256. +    elif test -f $ac_srcdir/configure; then
  8257. +      echo
  8258. +      $SHELL $ac_srcdir/configure  --help=recursive
  8259. +    elif test -f $ac_srcdir/configure.ac ||
  8260. +           test -f $ac_srcdir/configure.in; then
  8261. +      echo
  8262. +      $ac_configure --help
  8263. +    else
  8264. +      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
  8265. +    fi
  8266. +    cd $ac_popdir
  8267. +  done
  8268. +fi
  8269.  
  8270. -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
  8271. -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  8272. -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  8273. -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  8274. -echo "$ac_t""$host" 1>&6
  8275. -
  8276. -echo $ac_n "checking target system type""... $ac_c" 1>&6
  8277. -echo "configure:698: checking target system type" >&5
  8278. -
  8279. -target_alias=$target
  8280. -case "$target_alias" in
  8281. -NONE)
  8282. -  case $nonopt in
  8283. -  NONE) target_alias=$host_alias ;;
  8284. -  *) target_alias=$nonopt ;;
  8285. -  esac ;;
  8286. -esac
  8287. -
  8288. -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
  8289. -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  8290. -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  8291. -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  8292. -echo "$ac_t""$target" 1>&6
  8293. -
  8294. -echo $ac_n "checking build system type""... $ac_c" 1>&6
  8295. -echo "configure:716: checking build system type" >&5
  8296. -
  8297. -build_alias=$build
  8298. -case "$build_alias" in
  8299. -NONE)
  8300. -  case $nonopt in
  8301. -  NONE) build_alias=$host_alias ;;
  8302. -  *) build_alias=$nonopt ;;
  8303. -  esac ;;
  8304. -esac
  8305. -
  8306. -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
  8307. -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  8308. -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  8309. -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  8310. -echo "$ac_t""$build" 1>&6
  8311. +test -n "$ac_init_help" && exit 0
  8312. +if $ac_init_version; then
  8313. +  cat <<\_ACEOF
  8314. +
  8315. +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
  8316. +Free Software Foundation, Inc.
  8317. +This configure script is free software; the Free Software Foundation
  8318. +gives unlimited permission to copy, distribute and modify it.
  8319. +_ACEOF
  8320. +  exit 0
  8321. +fi
  8322. +exec 5>config.log
  8323. +cat >&5 <<_ACEOF
  8324. +This file contains any messages produced by compilers while
  8325. +running configure, to aid debugging if configure makes a mistake.
  8326.  
  8327. -test "$host_alias" != "$target_alias" &&
  8328. -  test "$program_prefix$program_suffix$program_transform_name" = \
  8329. -    NONENONEs,x,x, &&
  8330. -  program_prefix=${target_alias}-
  8331. +It was created by $as_me, which was
  8332. +generated by GNU Autoconf 2.57.  Invocation command line was
  8333.  
  8334. +  $ $0 $@
  8335.  
  8336. -        echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
  8337. -echo "configure:740: checking for strerror in -lcposix" >&5
  8338. -ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
  8339. -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  8340. -  echo $ac_n "(cached) $ac_c" 1>&6
  8341. -else
  8342. -  ac_save_LIBS="$LIBS"
  8343. -LIBS="-lcposix  $LIBS"
  8344. -cat > conftest.$ac_ext <<EOF
  8345. -#line 748 "configure"
  8346. -#include "confdefs.h"
  8347. -/* Override any gcc2 internal prototype to avoid an error.  */
  8348. -/* We use char because int might match the return type of a gcc2
  8349. -    builtin and then its argument prototype would still apply.  */
  8350. -char strerror();
  8351. +_ACEOF
  8352. +{
  8353. +cat <<_ASUNAME
  8354. +## --------- ##
  8355. +## Platform. ##
  8356. +## --------- ##
  8357. +
  8358. +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
  8359. +uname -m = `(uname -m) 2>/dev/null || echo unknown`
  8360. +uname -r = `(uname -r) 2>/dev/null || echo unknown`
  8361. +uname -s = `(uname -s) 2>/dev/null || echo unknown`
  8362. +uname -v = `(uname -v) 2>/dev/null || echo unknown`
  8363. +
  8364. +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
  8365. +/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
  8366. +
  8367. +/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
  8368. +/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
  8369. +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
  8370. +hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
  8371. +/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
  8372. +/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
  8373. +/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
  8374.  
  8375. -int main() {
  8376. -strerror()
  8377. -; return 0; }
  8378. -EOF
  8379. -if { (eval echo configure:759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  8380. -  rm -rf conftest*
  8381. -  eval "ac_cv_lib_$ac_lib_var=yes"
  8382. -else
  8383. -  echo "configure: failed program was:" >&5
  8384. -  cat conftest.$ac_ext >&5
  8385. -  rm -rf conftest*
  8386. -  eval "ac_cv_lib_$ac_lib_var=no"
  8387. -fi
  8388. -rm -f conftest*
  8389. -LIBS="$ac_save_LIBS"
  8390. +_ASUNAME
  8391.  
  8392. -fi
  8393. -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  8394. -  echo "$ac_t""yes" 1>&6
  8395. -  LIBS="$LIBS -lcposix"
  8396. -else
  8397. -  echo "$ac_t""no" 1>&6
  8398. -fi
  8399. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  8400. +for as_dir in $PATH
  8401. +do
  8402. +  IFS=$as_save_IFS
  8403. +  test -z "$as_dir" && as_dir=.
  8404. +  echo "PATH: $as_dir"
  8405. +done
  8406.  
  8407. +} >&5
  8408.    
  8409. +cat >&5 <<_ACEOF
  8410.  
  8411.  
  8412. -# Find a good install program.  We prefer a C program (faster),
  8413. -# so one script is as good as another.  But avoid the broken or
  8414. -# incompatible versions:
  8415. -# SysV /etc/install, /usr/sbin/install
  8416. -# SunOS /usr/etc/install
  8417. -# IRIX /sbin/install
  8418. -# AIX /bin/install
  8419. -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
  8420. -# AFS /usr/afsws/bin/install, which mishandles nonexistent args
  8421. -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  8422. -# ./install, which can be erroneously created by make from ./install.sh.
  8423. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
  8424. -echo "configure:794: checking for a BSD compatible install" >&5
  8425. -if test -z "$INSTALL"; then
  8426. -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
  8427. -  echo $ac_n "(cached) $ac_c" 1>&6
  8428. -else
  8429. -    IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS=":"
  8430. -  for ac_dir in $PATH; do
  8431. -    # Account for people who put trailing slashes in PATH elements.
  8432. -    case "$ac_dir/" in
  8433. -    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
  8434. -    *)
  8435. -      # OSF1 and SCO ODT 3.0 have their own names for install.
  8436. -      # Don't use installbsd from OSF since it installs stuff as root
  8437. -      # by default.
  8438. -      for ac_prog in ginstall scoinst install; do
  8439. -        if test -f $ac_dir/$ac_prog; then
  8440. -      if test $ac_prog = install &&
  8441. -            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  8442. -        # AIX install.  It has an incompatible calling convention.
  8443. -        :
  8444. +## ----------- ##
  8445. +## Core tests. ##
  8446. +## ----------- ##
  8447. +
  8448. +_ACEOF
  8449. +
  8450. +
  8451. +# Keep a trace of the command line.
  8452. +# Strip out --no-create and --no-recursion so they do not pile up.
  8453. +# Strip out --silent because we don't want to record it for future runs.
  8454. +# Also quote any args containing shell meta-characters.
  8455. +# Make two passes to allow for proper duplicate-argument suppression.
  8456. +ac_configure_args=
  8457. +ac_configure_args0=
  8458. +ac_configure_args1=
  8459. +ac_sep=
  8460. +ac_must_keep_next=false
  8461. +for ac_pass in 1 2
  8462. +do
  8463. +  for ac_arg
  8464. +  do
  8465. +    case $ac_arg in
  8466. +    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
  8467. +    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  8468. +    | -silent | --silent | --silen | --sile | --sil)
  8469. +      continue ;;
  8470. +    *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
  8471. +      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
  8472. +    esac
  8473. +    case $ac_pass in
  8474. +    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
  8475. +    2)
  8476. +      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
  8477. +      if test $ac_must_keep_next = true; then
  8478. +        ac_must_keep_next=false # Got value, back to normal.
  8479. +      else
  8480. +        case $ac_arg in
  8481. +          *=* | --config-cache | -C | -disable-* | --disable-* \
  8482. +          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
  8483. +          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
  8484. +          | -with-* | --with-* | -without-* | --without-* | --x)
  8485. +            case "$ac_configure_args0 " in
  8486. +              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
  8487. +            esac
  8488. +            ;;
  8489. +          -* ) ac_must_keep_next=true ;;
  8490. +        esac
  8491. +      fi
  8492. +      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
  8493. +      # Get rid of the leading space.
  8494. +      ac_sep=" "
  8495. +      ;;
  8496. +    esac
  8497. +  done
  8498. +done
  8499. +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
  8500. +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
  8501. +
  8502. +# When interrupted or exit'd, cleanup temporary files, and complete
  8503. +# config.log.  We remove comments because anyway the quotes in there
  8504. +# would cause problems or look ugly.
  8505. +# WARNING: Be sure not to use single quotes in there, as some shells,
  8506. +# such as our DU 5.0 friend, will then `close' the trap.
  8507. +trap 'exit_status=$?
  8508. +  # Save into config.log some information that might help in debugging.
  8509. +  {
  8510. +    echo
  8511. +
  8512. +    cat <<\_ASBOX
  8513. +## ---------------- ##
  8514. +## Cache variables. ##
  8515. +## ---------------- ##
  8516. +_ASBOX
  8517. +    echo
  8518. +    # The following way of writing the cache mishandles newlines in values,
  8519. +{
  8520. +  (set) 2>&1 |
  8521. +    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
  8522. +    *ac_space=\ *)
  8523. +      sed -n \
  8524. +        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
  8525. +          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
  8526. +      ;;
  8527. +    *)
  8528. +      sed -n \
  8529. +        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
  8530. +      ;;
  8531. +    esac;
  8532. +}
  8533. +    echo
  8534. +
  8535. +    cat <<\_ASBOX
  8536. +## ----------------- ##
  8537. +## Output variables. ##
  8538. +## ----------------- ##
  8539. +_ASBOX
  8540. +    echo
  8541. +    for ac_var in $ac_subst_vars
  8542. +    do
  8543. +      eval ac_val=$`echo $ac_var`
  8544. +      echo "$ac_var='"'"'$ac_val'"'"'"
  8545. +    done | sort
  8546. +    echo
  8547. +
  8548. +    if test -n "$ac_subst_files"; then
  8549. +      cat <<\_ASBOX
  8550. +## ------------- ##
  8551. +## Output files. ##
  8552. +## ------------- ##
  8553. +_ASBOX
  8554. +      echo
  8555. +      for ac_var in $ac_subst_files
  8556. +      do
  8557. +    eval ac_val=$`echo $ac_var`
  8558. +        echo "$ac_var='"'"'$ac_val'"'"'"
  8559. +      done | sort
  8560. +      echo
  8561. +    fi
  8562. +
  8563. +    if test -s confdefs.h; then
  8564. +      cat <<\_ASBOX
  8565. +## ----------- ##
  8566. +## confdefs.h. ##
  8567. +## ----------- ##
  8568. +_ASBOX
  8569. +      echo
  8570. +      sed "/^$/d" confdefs.h | sort
  8571. +      echo
  8572. +    fi
  8573. +    test "$ac_signal" != 0 &&
  8574. +      echo "$as_me: caught signal $ac_signal"
  8575. +    echo "$as_me: exit $exit_status"
  8576. +  } >&5
  8577. +  rm -f core core.* *.core &&
  8578. +  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
  8579. +    exit $exit_status
  8580. +     ' 0
  8581. +for ac_signal in 1 2 13 15; do
  8582. +  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
  8583. +done
  8584. +ac_signal=0
  8585. +
  8586. +# confdefs.h avoids OS command line length limits that DEFS can exceed.
  8587. +rm -rf conftest* confdefs.h
  8588. +# AIX cpp loses on an empty file, so make sure it contains at least a newline.
  8589. +echo >confdefs.h
  8590. +
  8591. +# Predefined preprocessor variables.
  8592. +
  8593. +cat >>confdefs.h <<_ACEOF
  8594. +#define PACKAGE_NAME "$PACKAGE_NAME"
  8595. +_ACEOF
  8596. +
  8597. +
  8598. +cat >>confdefs.h <<_ACEOF
  8599. +#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
  8600. +_ACEOF
  8601. +
  8602. +
  8603. +cat >>confdefs.h <<_ACEOF
  8604. +#define PACKAGE_VERSION "$PACKAGE_VERSION"
  8605. +_ACEOF
  8606. +
  8607. +
  8608. +cat >>confdefs.h <<_ACEOF
  8609. +#define PACKAGE_STRING "$PACKAGE_STRING"
  8610. +_ACEOF
  8611. +
  8612. +
  8613. +cat >>confdefs.h <<_ACEOF
  8614. +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
  8615. +_ACEOF
  8616. +
  8617. +
  8618. +# Let the site file select an alternate cache file if it wants to.
  8619. +# Prefer explicitly selected file to automatically selected ones.
  8620. +if test -z "$CONFIG_SITE"; then
  8621. +  if test "x$prefix" != xNONE; then
  8622. +    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
  8623.        else
  8624. -        ac_cv_path_install="$ac_dir/$ac_prog -c"
  8625. +    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
  8626. +  fi
  8627. +fi
  8628. +for ac_site_file in $CONFIG_SITE; do
  8629. +  if test -r "$ac_site_file"; then
  8630. +    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
  8631. +echo "$as_me: loading site script $ac_site_file" >&6;}
  8632. +    sed 's/^/| /' "$ac_site_file" >&5
  8633. +    . "$ac_site_file"
  8634. +  fi
  8635. +done
  8636. +
  8637. +if test -r "$cache_file"; then
  8638. +  # Some versions of bash will fail to source /dev/null (special
  8639. +  # files actually), so we avoid doing that.
  8640. +  if test -f "$cache_file"; then
  8641. +    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
  8642. +echo "$as_me: loading cache $cache_file" >&6;}
  8643. +    case $cache_file in
  8644. +      [\\/]* | ?:[\\/]* ) . $cache_file;;
  8645. +      *)                      . ./$cache_file;;
  8646. +    esac
  8647. +  fi
  8648. +else
  8649. +  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
  8650. +echo "$as_me: creating cache $cache_file" >&6;}
  8651. +  >$cache_file
  8652. +fi
  8653. +
  8654. +# Check that the precious variables saved in the cache have kept the same
  8655. +# value.
  8656. +ac_cache_corrupted=false
  8657. +for ac_var in `(set) 2>&1 |
  8658. +               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
  8659. +  eval ac_old_set=\$ac_cv_env_${ac_var}_set
  8660. +  eval ac_new_set=\$ac_env_${ac_var}_set
  8661. +  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
  8662. +  eval ac_new_val="\$ac_env_${ac_var}_value"
  8663. +  case $ac_old_set,$ac_new_set in
  8664. +    set,)
  8665. +      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
  8666. +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
  8667. +      ac_cache_corrupted=: ;;
  8668. +    ,set)
  8669. +      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
  8670. +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
  8671. +      ac_cache_corrupted=: ;;
  8672. +    ,);;
  8673. +    *)
  8674. +      if test "x$ac_old_val" != "x$ac_new_val"; then
  8675. +        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
  8676. +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
  8677. +        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
  8678. +echo "$as_me:   former value:  $ac_old_val" >&2;}
  8679. +        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
  8680. +echo "$as_me:   current value: $ac_new_val" >&2;}
  8681. +        ac_cache_corrupted=:
  8682. +      fi;;
  8683. +  esac
  8684. +  # Pass precious variables to config.status.
  8685. +  if test "$ac_new_set" = set; then
  8686. +    case $ac_new_val in
  8687. +    *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
  8688. +      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
  8689. +    *) ac_arg=$ac_var=$ac_new_val ;;
  8690. +    esac
  8691. +    case " $ac_configure_args " in
  8692. +      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
  8693. +      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
  8694. +    esac
  8695. +  fi
  8696. +done
  8697. +if $ac_cache_corrupted; then
  8698. +  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
  8699. +echo "$as_me: error: changes in the environment can compromise the build" >&2;}
  8700. +  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
  8701. +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
  8702. +   { (exit 1); exit 1; }; }
  8703. +fi
  8704. +
  8705. +ac_ext=c
  8706. +ac_cpp='$CPP $CPPFLAGS'
  8707. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  8708. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  8709. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  8710. +
  8711. +
  8712. +
  8713. +
  8714. +
  8715. +
  8716. +
  8717. +
  8718. +
  8719. +
  8720. +
  8721. +
  8722. +
  8723. +
  8724. +
  8725. +
  8726. +
  8727. +
  8728. +
  8729. +
  8730. +ac_aux_dir=
  8731. +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
  8732. +  if test -f $ac_dir/install-sh; then
  8733. +    ac_aux_dir=$ac_dir
  8734. +    ac_install_sh="$ac_aux_dir/install-sh -c"
  8735. +    break
  8736. +  elif test -f $ac_dir/install.sh; then
  8737. +    ac_aux_dir=$ac_dir
  8738. +    ac_install_sh="$ac_aux_dir/install.sh -c"
  8739. +    break
  8740. +  elif test -f $ac_dir/shtool; then
  8741. +    ac_aux_dir=$ac_dir
  8742. +    ac_install_sh="$ac_aux_dir/shtool install -c"
  8743. +    break
  8744. +  fi
  8745. +done
  8746. +if test -z "$ac_aux_dir"; then
  8747. +  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
  8748. +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
  8749. +   { (exit 1); exit 1; }; }
  8750. +fi
  8751. +ac_config_guess="$SHELL $ac_aux_dir/config.guess"
  8752. +ac_config_sub="$SHELL $ac_aux_dir/config.sub"
  8753. +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
  8754. +
  8755. +# Make sure we can run config.sub.
  8756. +$ac_config_sub sun4 >/dev/null 2>&1 ||
  8757. +  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
  8758. +echo "$as_me: error: cannot run $ac_config_sub" >&2;}
  8759. +   { (exit 1); exit 1; }; }
  8760. +
  8761. +echo "$as_me:$LINENO: checking build system type" >&5
  8762. +echo $ECHO_N "checking build system type... $ECHO_C" >&6
  8763. +if test "${ac_cv_build+set}" = set; then
  8764. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  8765. +else
  8766. +  ac_cv_build_alias=$build_alias
  8767. +test -z "$ac_cv_build_alias" &&
  8768. +  ac_cv_build_alias=`$ac_config_guess`
  8769. +test -z "$ac_cv_build_alias" &&
  8770. +  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
  8771. +echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
  8772. +   { (exit 1); exit 1; }; }
  8773. +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
  8774. +  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
  8775. +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
  8776. +   { (exit 1); exit 1; }; }
  8777. +
  8778. +fi
  8779. +echo "$as_me:$LINENO: result: $ac_cv_build" >&5
  8780. +echo "${ECHO_T}$ac_cv_build" >&6
  8781. +build=$ac_cv_build
  8782. +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  8783. +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  8784. +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  8785. +
  8786. +
  8787. +echo "$as_me:$LINENO: checking host system type" >&5
  8788. +echo $ECHO_N "checking host system type... $ECHO_C" >&6
  8789. +if test "${ac_cv_host+set}" = set; then
  8790. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  8791. +else
  8792. +  ac_cv_host_alias=$host_alias
  8793. +test -z "$ac_cv_host_alias" &&
  8794. +  ac_cv_host_alias=$ac_cv_build_alias
  8795. +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
  8796. +  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
  8797. +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
  8798. +   { (exit 1); exit 1; }; }
  8799. +
  8800. +fi
  8801. +echo "$as_me:$LINENO: result: $ac_cv_host" >&5
  8802. +echo "${ECHO_T}$ac_cv_host" >&6
  8803. +host=$ac_cv_host
  8804. +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  8805. +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  8806. +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  8807. +
  8808. +
  8809. +echo "$as_me:$LINENO: checking target system type" >&5
  8810. +echo $ECHO_N "checking target system type... $ECHO_C" >&6
  8811. +if test "${ac_cv_target+set}" = set; then
  8812. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  8813. +else
  8814. +  ac_cv_target_alias=$target_alias
  8815. +test "x$ac_cv_target_alias" = "x" &&
  8816. +  ac_cv_target_alias=$ac_cv_host_alias
  8817. +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
  8818. +  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
  8819. +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
  8820. +   { (exit 1); exit 1; }; }
  8821. +
  8822. +fi
  8823. +echo "$as_me:$LINENO: result: $ac_cv_target" >&5
  8824. +echo "${ECHO_T}$ac_cv_target" >&6
  8825. +target=$ac_cv_target
  8826. +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  8827. +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  8828. +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  8829. +
  8830. +
  8831. +# The aliases save the names the user supplied, while $host etc.
  8832. +# will get canonicalized.
  8833. +test -n "$target_alias" &&
  8834. +  test "$program_prefix$program_suffix$program_transform_name" = \
  8835. +    NONENONEs,x,x, &&
  8836. +  program_prefix=${target_alias}-
  8837. +ac_ext=c
  8838. +ac_cpp='$CPP $CPPFLAGS'
  8839. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  8840. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  8841. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  8842. +if test -n "$ac_tool_prefix"; then
  8843. +  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
  8844. +set dummy ${ac_tool_prefix}gcc; ac_word=$2
  8845. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  8846. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  8847. +if test "${ac_cv_prog_CC+set}" = set; then
  8848. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  8849. +else
  8850. +  if test -n "$CC"; then
  8851. +  ac_cv_prog_CC="$CC" # Let the user override the test.
  8852. +else
  8853. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  8854. +for as_dir in $PATH
  8855. +do
  8856. +  IFS=$as_save_IFS
  8857. +  test -z "$as_dir" && as_dir=.
  8858. +  for ac_exec_ext in '' $ac_executable_extensions; do
  8859. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  8860. +    ac_cv_prog_CC="${ac_tool_prefix}gcc"
  8861. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  8862. +        break 2
  8863. +      fi
  8864. +done
  8865. +done
  8866. +
  8867. +fi
  8868. +fi
  8869. +CC=$ac_cv_prog_CC
  8870. +if test -n "$CC"; then
  8871. +  echo "$as_me:$LINENO: result: $CC" >&5
  8872. +echo "${ECHO_T}$CC" >&6
  8873. +else
  8874. +  echo "$as_me:$LINENO: result: no" >&5
  8875. +echo "${ECHO_T}no" >&6
  8876. +fi
  8877. +
  8878. +fi
  8879. +if test -z "$ac_cv_prog_CC"; then
  8880. +  ac_ct_CC=$CC
  8881. +  # Extract the first word of "gcc", so it can be a program name with args.
  8882. +set dummy gcc; ac_word=$2
  8883. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  8884. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  8885. +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  8886. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  8887. +else
  8888. +  if test -n "$ac_ct_CC"; then
  8889. +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  8890. +else
  8891. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  8892. +for as_dir in $PATH
  8893. +do
  8894. +  IFS=$as_save_IFS
  8895. +  test -z "$as_dir" && as_dir=.
  8896. +  for ac_exec_ext in '' $ac_executable_extensions; do
  8897. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  8898. +    ac_cv_prog_ac_ct_CC="gcc"
  8899. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  8900. +    break 2
  8901. +    fi
  8902. +done
  8903. +done
  8904. +
  8905. +fi
  8906. +fi
  8907. +ac_ct_CC=$ac_cv_prog_ac_ct_CC
  8908. +if test -n "$ac_ct_CC"; then
  8909. +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
  8910. +echo "${ECHO_T}$ac_ct_CC" >&6
  8911. +else
  8912. +  echo "$as_me:$LINENO: result: no" >&5
  8913. +echo "${ECHO_T}no" >&6
  8914. +fi
  8915. +
  8916. +  CC=$ac_ct_CC
  8917. +else
  8918. +  CC="$ac_cv_prog_CC"
  8919. +fi
  8920. +
  8921. +if test -z "$CC"; then
  8922. +  if test -n "$ac_tool_prefix"; then
  8923. +  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
  8924. +set dummy ${ac_tool_prefix}cc; ac_word=$2
  8925. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  8926. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  8927. +if test "${ac_cv_prog_CC+set}" = set; then
  8928. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  8929. +else
  8930. +  if test -n "$CC"; then
  8931. +  ac_cv_prog_CC="$CC" # Let the user override the test.
  8932. +else
  8933. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  8934. +for as_dir in $PATH
  8935. +do
  8936. +  IFS=$as_save_IFS
  8937. +  test -z "$as_dir" && as_dir=.
  8938. +  for ac_exec_ext in '' $ac_executable_extensions; do
  8939. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  8940. +    ac_cv_prog_CC="${ac_tool_prefix}cc"
  8941. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  8942.          break 2
  8943.        fi
  8944. +done
  8945. +done
  8946. +
  8947. +fi
  8948. +fi
  8949. +CC=$ac_cv_prog_CC
  8950. +if test -n "$CC"; then
  8951. +  echo "$as_me:$LINENO: result: $CC" >&5
  8952. +echo "${ECHO_T}$CC" >&6
  8953. +else
  8954. +  echo "$as_me:$LINENO: result: no" >&5
  8955. +echo "${ECHO_T}no" >&6
  8956. +fi
  8957. +
  8958. +fi
  8959. +if test -z "$ac_cv_prog_CC"; then
  8960. +  ac_ct_CC=$CC
  8961. +  # Extract the first word of "cc", so it can be a program name with args.
  8962. +set dummy cc; ac_word=$2
  8963. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  8964. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  8965. +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  8966. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  8967. +else
  8968. +  if test -n "$ac_ct_CC"; then
  8969. +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  8970. +else
  8971. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  8972. +for as_dir in $PATH
  8973. +do
  8974. +  IFS=$as_save_IFS
  8975. +  test -z "$as_dir" && as_dir=.
  8976. +  for ac_exec_ext in '' $ac_executable_extensions; do
  8977. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  8978. +    ac_cv_prog_ac_ct_CC="cc"
  8979. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  8980. +    break 2
  8981. +  fi
  8982. +done
  8983. +done
  8984. +
  8985. +fi
  8986. +fi
  8987. +ac_ct_CC=$ac_cv_prog_ac_ct_CC
  8988. +if test -n "$ac_ct_CC"; then
  8989. +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
  8990. +echo "${ECHO_T}$ac_ct_CC" >&6
  8991. +else
  8992. +  echo "$as_me:$LINENO: result: no" >&5
  8993. +echo "${ECHO_T}no" >&6
  8994. +fi
  8995. +
  8996. +  CC=$ac_ct_CC
  8997. +else
  8998. +  CC="$ac_cv_prog_CC"
  8999. +fi
  9000. +
  9001. +fi
  9002. +if test -z "$CC"; then
  9003. +  # Extract the first word of "cc", so it can be a program name with args.
  9004. +set dummy cc; ac_word=$2
  9005. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  9006. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  9007. +if test "${ac_cv_prog_CC+set}" = set; then
  9008. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9009. +else
  9010. +  if test -n "$CC"; then
  9011. +  ac_cv_prog_CC="$CC" # Let the user override the test.
  9012. +else
  9013. +  ac_prog_rejected=no
  9014. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  9015. +for as_dir in $PATH
  9016. +do
  9017. +  IFS=$as_save_IFS
  9018. +  test -z "$as_dir" && as_dir=.
  9019. +  for ac_exec_ext in '' $ac_executable_extensions; do
  9020. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  9021. +    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
  9022. +       ac_prog_rejected=yes
  9023. +       continue
  9024. +     fi
  9025. +    ac_cv_prog_CC="cc"
  9026. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  9027. +    break 2
  9028. +  fi
  9029. +done
  9030. +done
  9031. +
  9032. +if test $ac_prog_rejected = yes; then
  9033. +  # We found a bogon in the path, so make sure we never use it.
  9034. +  set dummy $ac_cv_prog_CC
  9035. +  shift
  9036. +  if test $# != 0; then
  9037. +    # We chose a different compiler from the bogus one.
  9038. +    # However, it has the same basename, so the bogon will be chosen
  9039. +    # first if we set CC to just the basename; use the full file name.
  9040. +    shift
  9041. +    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
  9042. +  fi
  9043. +fi
  9044. +fi
  9045. +fi
  9046. +CC=$ac_cv_prog_CC
  9047. +if test -n "$CC"; then
  9048. +  echo "$as_me:$LINENO: result: $CC" >&5
  9049. +echo "${ECHO_T}$CC" >&6
  9050. +else
  9051. +  echo "$as_me:$LINENO: result: no" >&5
  9052. +echo "${ECHO_T}no" >&6
  9053. +fi
  9054. +
  9055. +fi
  9056. +if test -z "$CC"; then
  9057. +  if test -n "$ac_tool_prefix"; then
  9058. +  for ac_prog in cl
  9059. +  do
  9060. +    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
  9061. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2
  9062. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  9063. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  9064. +if test "${ac_cv_prog_CC+set}" = set; then
  9065. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9066. +else
  9067. +  if test -n "$CC"; then
  9068. +  ac_cv_prog_CC="$CC" # Let the user override the test.
  9069. +else
  9070. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  9071. +for as_dir in $PATH
  9072. +do
  9073. +  IFS=$as_save_IFS
  9074. +  test -z "$as_dir" && as_dir=.
  9075. +  for ac_exec_ext in '' $ac_executable_extensions; do
  9076. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  9077. +    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
  9078. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  9079. +    break 2
  9080.      fi
  9081. +done
  9082. +done
  9083. +
  9084. +fi
  9085. +fi
  9086. +CC=$ac_cv_prog_CC
  9087. +if test -n "$CC"; then
  9088. +  echo "$as_me:$LINENO: result: $CC" >&5
  9089. +echo "${ECHO_T}$CC" >&6
  9090. +else
  9091. +  echo "$as_me:$LINENO: result: no" >&5
  9092. +echo "${ECHO_T}no" >&6
  9093. +fi
  9094. +
  9095. +    test -n "$CC" && break
  9096.        done
  9097. +fi
  9098. +if test -z "$CC"; then
  9099. +  ac_ct_CC=$CC
  9100. +  for ac_prog in cl
  9101. +do
  9102. +  # Extract the first word of "$ac_prog", so it can be a program name with args.
  9103. +set dummy $ac_prog; ac_word=$2
  9104. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  9105. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  9106. +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  9107. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9108. +else
  9109. +  if test -n "$ac_ct_CC"; then
  9110. +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  9111. +else
  9112. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  9113. +for as_dir in $PATH
  9114. +do
  9115. +  IFS=$as_save_IFS
  9116. +  test -z "$as_dir" && as_dir=.
  9117. +  for ac_exec_ext in '' $ac_executable_extensions; do
  9118. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  9119. +    ac_cv_prog_ac_ct_CC="$ac_prog"
  9120. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  9121. +    break 2
  9122. +  fi
  9123. +done
  9124. +done
  9125. +
  9126. +fi
  9127. +fi
  9128. +ac_ct_CC=$ac_cv_prog_ac_ct_CC
  9129. +if test -n "$ac_ct_CC"; then
  9130. +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
  9131. +echo "${ECHO_T}$ac_ct_CC" >&6
  9132. +else
  9133. +  echo "$as_me:$LINENO: result: no" >&5
  9134. +echo "${ECHO_T}no" >&6
  9135. +fi
  9136. +
  9137. +  test -n "$ac_ct_CC" && break
  9138. +done
  9139. +
  9140. +  CC=$ac_ct_CC
  9141. +fi
  9142. +
  9143. +fi
  9144. +
  9145. +
  9146. +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
  9147. +See \`config.log' for more details." >&5
  9148. +echo "$as_me: error: no acceptable C compiler found in \$PATH
  9149. +See \`config.log' for more details." >&2;}
  9150. +   { (exit 1); exit 1; }; }
  9151. +
  9152. +# Provide some information about the compiler.
  9153. +echo "$as_me:$LINENO:" \
  9154. +     "checking for C compiler version" >&5
  9155. +ac_compiler=`set X $ac_compile; echo $2`
  9156. +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
  9157. +  (eval $ac_compiler --version </dev/null >&5) 2>&5
  9158. +  ac_status=$?
  9159. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9160. +  (exit $ac_status); }
  9161. +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
  9162. +  (eval $ac_compiler -v </dev/null >&5) 2>&5
  9163. +  ac_status=$?
  9164. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9165. +  (exit $ac_status); }
  9166. +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
  9167. +  (eval $ac_compiler -V </dev/null >&5) 2>&5
  9168. +  ac_status=$?
  9169. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9170. +  (exit $ac_status); }
  9171. +
  9172. +cat >conftest.$ac_ext <<_ACEOF
  9173. +#line $LINENO "configure"
  9174. +/* confdefs.h.  */
  9175. +_ACEOF
  9176. +cat confdefs.h >>conftest.$ac_ext
  9177. +cat >>conftest.$ac_ext <<_ACEOF
  9178. +/* end confdefs.h.  */
  9179. +
  9180. +int
  9181. +main ()
  9182. +{
  9183. +
  9184. +  ;
  9185. +  return 0;
  9186. +}
  9187. +_ACEOF
  9188. +ac_clean_files_save=$ac_clean_files
  9189. +ac_clean_files="$ac_clean_files a.out a.exe b.out"
  9190. +# Try to create an executable without -o first, disregard a.out.
  9191. +# It will help us diagnose broken compilers, and finding out an intuition
  9192. +# of exeext.
  9193. +echo "$as_me:$LINENO: checking for C compiler default output" >&5
  9194. +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
  9195. +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
  9196. +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
  9197. +  (eval $ac_link_default) 2>&5
  9198. +  ac_status=$?
  9199. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9200. +  (exit $ac_status); }; then
  9201. +  # Find the output, starting from the most likely.  This scheme is
  9202. +# not robust to junk in `.', hence go to wildcards (a.*) only as a last
  9203. +# resort.
  9204. +
  9205. +# Be careful to initialize this variable, since it used to be cached.
  9206. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
  9207. +ac_cv_exeext=
  9208. +# b.out is created by i960 compilers.
  9209. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
  9210. +do
  9211. +  test -f "$ac_file" || continue
  9212. +  case $ac_file in
  9213. +    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
  9214.        ;;
  9215. +    conftest.$ac_ext )
  9216. +        # This is the source file.
  9217. +      ;;
  9218. +    [ab].out )
  9219. +        # We found the default executable, but exeext='' is most
  9220. +        # certainly right.
  9221. +        break;;
  9222. +    *.* )
  9223. +        ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
  9224. +        # FIXME: I believe we export ac_cv_exeext for Libtool,
  9225. +        # but it would be cool to find out if it's true.  Does anybody
  9226. +        # maintain Libtool? --akim.
  9227. +        export ac_cv_exeext
  9228. +        break;;
  9229. +    * )
  9230. +        break;;
  9231.      esac
  9232. +done
  9233. +else
  9234. +  echo "$as_me: failed program was:" >&5
  9235. +sed 's/^/| /' conftest.$ac_ext >&5
  9236. +
  9237. +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
  9238. +See \`config.log' for more details." >&5
  9239. +echo "$as_me: error: C compiler cannot create executables
  9240. +See \`config.log' for more details." >&2;}
  9241. +   { (exit 77); exit 77; }; }
  9242. +fi
  9243. +
  9244. +ac_exeext=$ac_cv_exeext
  9245. +echo "$as_me:$LINENO: result: $ac_file" >&5
  9246. +echo "${ECHO_T}$ac_file" >&6
  9247. +
  9248. +# Check the compiler produces executables we can run.  If not, either
  9249. +# the compiler is broken, or we cross compile.
  9250. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5
  9251. +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
  9252. +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
  9253. +# If not cross compiling, check that we can run a simple program.
  9254. +if test "$cross_compiling" != yes; then
  9255. +  if { ac_try='./$ac_file'
  9256. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9257. +  (eval $ac_try) 2>&5
  9258. +  ac_status=$?
  9259. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9260. +  (exit $ac_status); }; }; then
  9261. +    cross_compiling=no
  9262. +  else
  9263. +    if test "$cross_compiling" = maybe; then
  9264. +    cross_compiling=yes
  9265. +    else
  9266. +    { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
  9267. +If you meant to cross compile, use \`--host'.
  9268. +See \`config.log' for more details." >&5
  9269. +echo "$as_me: error: cannot run C compiled programs.
  9270. +If you meant to cross compile, use \`--host'.
  9271. +See \`config.log' for more details." >&2;}
  9272. +   { (exit 1); exit 1; }; }
  9273. +    fi
  9274. +  fi
  9275. +fi
  9276. +echo "$as_me:$LINENO: result: yes" >&5
  9277. +echo "${ECHO_T}yes" >&6
  9278. +
  9279. +rm -f a.out a.exe conftest$ac_cv_exeext b.out
  9280. +ac_clean_files=$ac_clean_files_save
  9281. +# Check the compiler produces executables we can run.  If not, either
  9282. +# the compiler is broken, or we cross compile.
  9283. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
  9284. +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
  9285. +echo "$as_me:$LINENO: result: $cross_compiling" >&5
  9286. +echo "${ECHO_T}$cross_compiling" >&6
  9287. +
  9288. +echo "$as_me:$LINENO: checking for suffix of executables" >&5
  9289. +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
  9290. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  9291. +  (eval $ac_link) 2>&5
  9292. +  ac_status=$?
  9293. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9294. +  (exit $ac_status); }; then
  9295. +  # If both `conftest.exe' and `conftest' are `present' (well, observable)
  9296. +# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
  9297. +# work properly (i.e., refer to `conftest.exe'), while it won't with
  9298. +# `rm'.
  9299. +for ac_file in conftest.exe conftest conftest.*; do
  9300. +  test -f "$ac_file" || continue
  9301. +  case $ac_file in
  9302. +    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
  9303. +    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
  9304. +          export ac_cv_exeext
  9305. +          break;;
  9306. +    * ) break;;
  9307. +    esac
  9308. +done
  9309. +else
  9310. +  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
  9311. +See \`config.log' for more details." >&5
  9312. +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
  9313. +See \`config.log' for more details." >&2;}
  9314. +   { (exit 1); exit 1; }; }
  9315. +fi
  9316. +
  9317. +rm -f conftest$ac_cv_exeext
  9318. +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
  9319. +echo "${ECHO_T}$ac_cv_exeext" >&6
  9320. +
  9321. +rm -f conftest.$ac_ext
  9322. +EXEEXT=$ac_cv_exeext
  9323. +ac_exeext=$EXEEXT
  9324. +echo "$as_me:$LINENO: checking for suffix of object files" >&5
  9325. +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
  9326. +if test "${ac_cv_objext+set}" = set; then
  9327. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9328. +else
  9329. +  cat >conftest.$ac_ext <<_ACEOF
  9330. +#line $LINENO "configure"
  9331. +/* confdefs.h.  */
  9332. +_ACEOF
  9333. +cat confdefs.h >>conftest.$ac_ext
  9334. +cat >>conftest.$ac_ext <<_ACEOF
  9335. +/* end confdefs.h.  */
  9336. +
  9337. +int
  9338. +main ()
  9339. +{
  9340. +
  9341. +  ;
  9342. +  return 0;
  9343. +}
  9344. +_ACEOF
  9345. +rm -f conftest.o conftest.obj
  9346. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9347. +  (eval $ac_compile) 2>&5
  9348. +  ac_status=$?
  9349. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9350. +  (exit $ac_status); }; then
  9351. +  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
  9352. +  case $ac_file in
  9353. +    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
  9354. +    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
  9355. +       break;;
  9356. +  esac
  9357. +done
  9358. +else
  9359. +  echo "$as_me: failed program was:" >&5
  9360. +sed 's/^/| /' conftest.$ac_ext >&5
  9361. +
  9362. +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
  9363. +See \`config.log' for more details." >&5
  9364. +echo "$as_me: error: cannot compute suffix of object files: cannot compile
  9365. +See \`config.log' for more details." >&2;}
  9366. +   { (exit 1); exit 1; }; }
  9367. +fi
  9368. +
  9369. +rm -f conftest.$ac_cv_objext conftest.$ac_ext
  9370. +fi
  9371. +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
  9372. +echo "${ECHO_T}$ac_cv_objext" >&6
  9373. +OBJEXT=$ac_cv_objext
  9374. +ac_objext=$OBJEXT
  9375. +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
  9376. +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
  9377. +if test "${ac_cv_c_compiler_gnu+set}" = set; then
  9378. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9379. +else
  9380. +  cat >conftest.$ac_ext <<_ACEOF
  9381. +#line $LINENO "configure"
  9382. +/* confdefs.h.  */
  9383. +_ACEOF
  9384. +cat confdefs.h >>conftest.$ac_ext
  9385. +cat >>conftest.$ac_ext <<_ACEOF
  9386. +/* end confdefs.h.  */
  9387. +
  9388. +int
  9389. +main ()
  9390. +{
  9391. +#ifndef __GNUC__
  9392. +       choke me
  9393. +#endif
  9394. +
  9395. +  ;
  9396. +  return 0;
  9397. +}
  9398. +_ACEOF
  9399. +rm -f conftest.$ac_objext
  9400. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9401. +  (eval $ac_compile) 2>&5
  9402. +  ac_status=$?
  9403. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9404. +  (exit $ac_status); } &&
  9405. +         { ac_try='test -s conftest.$ac_objext'
  9406. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9407. +  (eval $ac_try) 2>&5
  9408. +  ac_status=$?
  9409. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9410. +  (exit $ac_status); }; }; then
  9411. +  ac_compiler_gnu=yes
  9412. +else
  9413. +  echo "$as_me: failed program was:" >&5
  9414. +sed 's/^/| /' conftest.$ac_ext >&5
  9415. +
  9416. +ac_compiler_gnu=no
  9417. +fi
  9418. +rm -f conftest.$ac_objext conftest.$ac_ext
  9419. +ac_cv_c_compiler_gnu=$ac_compiler_gnu
  9420. +
  9421. +fi
  9422. +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
  9423. +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
  9424. +GCC=`test $ac_compiler_gnu = yes && echo yes`
  9425. +ac_test_CFLAGS=${CFLAGS+set}
  9426. +ac_save_CFLAGS=$CFLAGS
  9427. +CFLAGS="-g"
  9428. +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
  9429. +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
  9430. +if test "${ac_cv_prog_cc_g+set}" = set; then
  9431. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9432. +else
  9433. +  cat >conftest.$ac_ext <<_ACEOF
  9434. +#line $LINENO "configure"
  9435. +/* confdefs.h.  */
  9436. +_ACEOF
  9437. +cat confdefs.h >>conftest.$ac_ext
  9438. +cat >>conftest.$ac_ext <<_ACEOF
  9439. +/* end confdefs.h.  */
  9440. +
  9441. +int
  9442. +main ()
  9443. +{
  9444. +
  9445. +  ;
  9446. +  return 0;
  9447. +}
  9448. +_ACEOF
  9449. +rm -f conftest.$ac_objext
  9450. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9451. +  (eval $ac_compile) 2>&5
  9452. +  ac_status=$?
  9453. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9454. +  (exit $ac_status); } &&
  9455. +         { ac_try='test -s conftest.$ac_objext'
  9456. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9457. +  (eval $ac_try) 2>&5
  9458. +  ac_status=$?
  9459. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9460. +  (exit $ac_status); }; }; then
  9461. +  ac_cv_prog_cc_g=yes
  9462. +else
  9463. +  echo "$as_me: failed program was:" >&5
  9464. +sed 's/^/| /' conftest.$ac_ext >&5
  9465. +
  9466. +ac_cv_prog_cc_g=no
  9467. +fi
  9468. +rm -f conftest.$ac_objext conftest.$ac_ext
  9469. +fi
  9470. +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
  9471. +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
  9472. +if test "$ac_test_CFLAGS" = set; then
  9473. +  CFLAGS=$ac_save_CFLAGS
  9474. +elif test $ac_cv_prog_cc_g = yes; then
  9475. +  if test "$GCC" = yes; then
  9476. +    CFLAGS="-g -O2"
  9477. +  else
  9478. +    CFLAGS="-g"
  9479. +  fi
  9480. +else
  9481. +  if test "$GCC" = yes; then
  9482. +    CFLAGS="-O2"
  9483. +  else
  9484. +    CFLAGS=
  9485. +  fi
  9486. +fi
  9487. +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
  9488. +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
  9489. +if test "${ac_cv_prog_cc_stdc+set}" = set; then
  9490. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9491. +else
  9492. +  ac_cv_prog_cc_stdc=no
  9493. +ac_save_CC=$CC
  9494. +cat >conftest.$ac_ext <<_ACEOF
  9495. +#line $LINENO "configure"
  9496. +/* confdefs.h.  */
  9497. +_ACEOF
  9498. +cat confdefs.h >>conftest.$ac_ext
  9499. +cat >>conftest.$ac_ext <<_ACEOF
  9500. +/* end confdefs.h.  */
  9501. +#include <stdarg.h>
  9502. +#include <stdio.h>
  9503. +#include <sys/types.h>
  9504. +#include <sys/stat.h>
  9505. +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
  9506. +struct buf { int x; };
  9507. +FILE * (*rcsopen) (struct buf *, struct stat *, int);
  9508. +static char *e (p, i)
  9509. +     char **p;
  9510. +     int i;
  9511. +{
  9512. +  return p[i];
  9513. +}
  9514. +static char *f (char * (*g) (char **, int), char **p, ...)
  9515. +{
  9516. +  char *s;
  9517. +  va_list v;
  9518. +  va_start (v,p);
  9519. +  s = g (p, va_arg (v,int));
  9520. +  va_end (v);
  9521. +  return s;
  9522. +}
  9523. +int test (int i, double x);
  9524. +struct s1 {int (*f) (int a);};
  9525. +struct s2 {int (*f) (double a);};
  9526. +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
  9527. +int argc;
  9528. +char **argv;
  9529. +int
  9530. +main ()
  9531. +{
  9532. +return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
  9533. +  ;
  9534. +  return 0;
  9535. +}
  9536. +_ACEOF
  9537. +# Don't try gcc -ansi; that turns off useful extensions and
  9538. +# breaks some systems' header files.
  9539. +# AIX            -qlanglvl=ansi
  9540. +# Ultrix and OSF/1    -std1
  9541. +# HP-UX 10.20 and later    -Ae
  9542. +# HP-UX older versions    -Aa -D_HPUX_SOURCE
  9543. +# SVR4            -Xc -D__EXTENSIONS__
  9544. +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
  9545. +do
  9546. +  CC="$ac_save_CC $ac_arg"
  9547. +  rm -f conftest.$ac_objext
  9548. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9549. +  (eval $ac_compile) 2>&5
  9550. +  ac_status=$?
  9551. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9552. +  (exit $ac_status); } &&
  9553. +         { ac_try='test -s conftest.$ac_objext'
  9554. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9555. +  (eval $ac_try) 2>&5
  9556. +  ac_status=$?
  9557. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9558. +  (exit $ac_status); }; }; then
  9559. +  ac_cv_prog_cc_stdc=$ac_arg
  9560. +break
  9561. +else
  9562. +  echo "$as_me: failed program was:" >&5
  9563. +sed 's/^/| /' conftest.$ac_ext >&5
  9564. +
  9565. +fi
  9566. +rm -f conftest.$ac_objext
  9567. +done
  9568. +rm -f conftest.$ac_ext conftest.$ac_objext
  9569. +CC=$ac_save_CC
  9570. +
  9571. +fi
  9572. +
  9573. +case "x$ac_cv_prog_cc_stdc" in
  9574. +  x|xno)
  9575. +    echo "$as_me:$LINENO: result: none needed" >&5
  9576. +echo "${ECHO_T}none needed" >&6 ;;
  9577. +  *)
  9578. +    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
  9579. +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
  9580. +    CC="$CC $ac_cv_prog_cc_stdc" ;;
  9581. +esac
  9582. +
  9583. +# Some people use a C++ compiler to compile C.  Since we use `exit',
  9584. +# in C++ we need to declare it.  In case someone uses the same compiler
  9585. +# for both compiling C and C++ we need to have the C++ compiler decide
  9586. +# the declaration of exit, since it's the most demanding environment.
  9587. +cat >conftest.$ac_ext <<_ACEOF
  9588. +#ifndef __cplusplus
  9589. +  choke me
  9590. +#endif
  9591. +_ACEOF
  9592. +rm -f conftest.$ac_objext
  9593. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9594. +  (eval $ac_compile) 2>&5
  9595. +  ac_status=$?
  9596. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9597. +  (exit $ac_status); } &&
  9598. +         { ac_try='test -s conftest.$ac_objext'
  9599. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9600. +  (eval $ac_try) 2>&5
  9601. +  ac_status=$?
  9602. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9603. +  (exit $ac_status); }; }; then
  9604. +  for ac_declaration in \
  9605. +   ''\
  9606. +   '#include <stdlib.h>' \
  9607. +   'extern "C" void std::exit (int) throw (); using std::exit;' \
  9608. +   'extern "C" void std::exit (int); using std::exit;' \
  9609. +   'extern "C" void exit (int) throw ();' \
  9610. +   'extern "C" void exit (int);' \
  9611. +   'void exit (int);'
  9612. +do
  9613. +  cat >conftest.$ac_ext <<_ACEOF
  9614. +#line $LINENO "configure"
  9615. +/* confdefs.h.  */
  9616. +_ACEOF
  9617. +cat confdefs.h >>conftest.$ac_ext
  9618. +cat >>conftest.$ac_ext <<_ACEOF
  9619. +/* end confdefs.h.  */
  9620. +#include <stdlib.h>
  9621. +$ac_declaration
  9622. +int
  9623. +main ()
  9624. +{
  9625. +exit (42);
  9626. +  ;
  9627. +  return 0;
  9628. +}
  9629. +_ACEOF
  9630. +rm -f conftest.$ac_objext
  9631. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9632. +  (eval $ac_compile) 2>&5
  9633. +  ac_status=$?
  9634. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9635. +  (exit $ac_status); } &&
  9636. +         { ac_try='test -s conftest.$ac_objext'
  9637. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9638. +  (eval $ac_try) 2>&5
  9639. +  ac_status=$?
  9640. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9641. +  (exit $ac_status); }; }; then
  9642. +  :
  9643. +else
  9644. +  echo "$as_me: failed program was:" >&5
  9645. +sed 's/^/| /' conftest.$ac_ext >&5
  9646. +
  9647. +continue
  9648. +fi
  9649. +rm -f conftest.$ac_objext conftest.$ac_ext
  9650. +  cat >conftest.$ac_ext <<_ACEOF
  9651. +#line $LINENO "configure"
  9652. +/* confdefs.h.  */
  9653. +_ACEOF
  9654. +cat confdefs.h >>conftest.$ac_ext
  9655. +cat >>conftest.$ac_ext <<_ACEOF
  9656. +/* end confdefs.h.  */
  9657. +$ac_declaration
  9658. +int
  9659. +main ()
  9660. +{
  9661. +exit (42);
  9662. +  ;
  9663. +  return 0;
  9664. +}
  9665. +_ACEOF
  9666. +rm -f conftest.$ac_objext
  9667. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9668. +  (eval $ac_compile) 2>&5
  9669. +  ac_status=$?
  9670. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9671. +  (exit $ac_status); } &&
  9672. +         { ac_try='test -s conftest.$ac_objext'
  9673. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9674. +  (eval $ac_try) 2>&5
  9675. +  ac_status=$?
  9676. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9677. +  (exit $ac_status); }; }; then
  9678. +  break
  9679. +else
  9680. +  echo "$as_me: failed program was:" >&5
  9681. +sed 's/^/| /' conftest.$ac_ext >&5
  9682. +
  9683. +fi
  9684. +rm -f conftest.$ac_objext conftest.$ac_ext
  9685. +done
  9686. +rm -f conftest*
  9687. +if test -n "$ac_declaration"; then
  9688. +  echo '#ifdef __cplusplus' >>confdefs.h
  9689. +  echo $ac_declaration      >>confdefs.h
  9690. +  echo '#endif'             >>confdefs.h
  9691. +fi
  9692. +
  9693. +else
  9694. +  echo "$as_me: failed program was:" >&5
  9695. +sed 's/^/| /' conftest.$ac_ext >&5
  9696. +
  9697. +fi
  9698. +rm -f conftest.$ac_objext conftest.$ac_ext
  9699. +ac_ext=c
  9700. +ac_cpp='$CPP $CPPFLAGS'
  9701. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  9702. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  9703. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  9704. +
  9705. +
  9706. +
  9707. +        echo "$as_me:$LINENO: checking for strerror in -lcposix" >&5
  9708. +echo $ECHO_N "checking for strerror in -lcposix... $ECHO_C" >&6
  9709. +if test "${ac_cv_lib_cposix_strerror+set}" = set; then
  9710. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9711. +else
  9712. +  ac_check_lib_save_LIBS=$LIBS
  9713. +LIBS="-lcposix  $LIBS"
  9714. +cat >conftest.$ac_ext <<_ACEOF
  9715. +#line $LINENO "configure"
  9716. +/* confdefs.h.  */
  9717. +_ACEOF
  9718. +cat confdefs.h >>conftest.$ac_ext
  9719. +cat >>conftest.$ac_ext <<_ACEOF
  9720. +/* end confdefs.h.  */
  9721. +
  9722. +/* Override any gcc2 internal prototype to avoid an error.  */
  9723. +#ifdef __cplusplus
  9724. +extern "C"
  9725. +#endif
  9726. +/* We use char because int might match the return type of a gcc2
  9727. +   builtin and then its argument prototype would still apply.  */
  9728. +char strerror ();
  9729. +int
  9730. +main ()
  9731. +{
  9732. +strerror ();
  9733. +  ;
  9734. +  return 0;
  9735. +}
  9736. +_ACEOF
  9737. +rm -f conftest.$ac_objext conftest$ac_exeext
  9738. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  9739. +  (eval $ac_link) 2>&5
  9740. +  ac_status=$?
  9741. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9742. +  (exit $ac_status); } &&
  9743. +         { ac_try='test -s conftest$ac_exeext'
  9744. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9745. +  (eval $ac_try) 2>&5
  9746. +  ac_status=$?
  9747. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9748. +  (exit $ac_status); }; }; then
  9749. +  ac_cv_lib_cposix_strerror=yes
  9750. +else
  9751. +  echo "$as_me: failed program was:" >&5
  9752. +sed 's/^/| /' conftest.$ac_ext >&5
  9753. +
  9754. +ac_cv_lib_cposix_strerror=no
  9755. +fi
  9756. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  9757. +LIBS=$ac_check_lib_save_LIBS
  9758. +fi
  9759. +echo "$as_me:$LINENO: result: $ac_cv_lib_cposix_strerror" >&5
  9760. +echo "${ECHO_T}$ac_cv_lib_cposix_strerror" >&6
  9761. +if test $ac_cv_lib_cposix_strerror = yes; then
  9762. +  LIBS="$LIBS -lcposix"
  9763. +fi
  9764. +
  9765. +
  9766. +
  9767. +
  9768. +am__api_version="1.6"
  9769. +# Find a good install program.  We prefer a C program (faster),
  9770. +# so one script is as good as another.  But avoid the broken or
  9771. +# incompatible versions:
  9772. +# SysV /etc/install, /usr/sbin/install
  9773. +# SunOS /usr/etc/install
  9774. +# IRIX /sbin/install
  9775. +# AIX /bin/install
  9776. +# AmigaOS /C/install, which installs bootblocks on floppy discs
  9777. +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
  9778. +# AFS /usr/afsws/bin/install, which mishandles nonexistent args
  9779. +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  9780. +# ./install, which can be erroneously created by make from ./install.sh.
  9781. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
  9782. +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
  9783. +if test -z "$INSTALL"; then
  9784. +if test "${ac_cv_path_install+set}" = set; then
  9785. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9786. +else
  9787. +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  9788. +for as_dir in $PATH
  9789. +do
  9790. +  IFS=$as_save_IFS
  9791. +  test -z "$as_dir" && as_dir=.
  9792. +  # Account for people who put trailing slashes in PATH elements.
  9793. +case $as_dir/ in
  9794. +  ./ | .// | /cC/* | \
  9795. +  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
  9796. +  /usr/ucb/* ) ;;
  9797. +  *)
  9798. +    # OSF1 and SCO ODT 3.0 have their own names for install.
  9799. +    # Don't use installbsd from OSF since it installs stuff as root
  9800. +    # by default.
  9801. +    for ac_prog in ginstall scoinst install; do
  9802. +      for ac_exec_ext in '' $ac_executable_extensions; do
  9803. +        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
  9804. +          if test $ac_prog = install &&
  9805. +            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
  9806. +            # AIX install.  It has an incompatible calling convention.
  9807. +            :
  9808. +          elif test $ac_prog = install &&
  9809. +            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
  9810. +            # program-specific install script used by HP pwplus--don't use.
  9811. +            :
  9812. +          else
  9813. +            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
  9814. +            break 3
  9815. +          fi
  9816. +        fi
  9817.    done
  9818. -  IFS="$ac_save_IFS"
  9819. +  done
  9820. +    ;;
  9821. +esac
  9822. +done
  9823. +
  9824.  
  9825.  fi
  9826.    if test "${ac_cv_path_install+set}" = set; then
  9827. -    INSTALL="$ac_cv_path_install"
  9828. +    INSTALL=$ac_cv_path_install
  9829.    else
  9830.      # As a last resort, use the slow shell script.  We don't cache a
  9831.      # path for INSTALL within a source directory, because that will
  9832.      # break other packages using the cache if that directory is
  9833.      # removed, or if the path is relative.
  9834. -    INSTALL="$ac_install_sh"
  9835. +    INSTALL=$ac_install_sh
  9836.    fi
  9837.  fi
  9838. -echo "$ac_t""$INSTALL" 1>&6
  9839. +echo "$as_me:$LINENO: result: $INSTALL" >&5
  9840. +echo "${ECHO_T}$INSTALL" >&6
  9841.  
  9842.  # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
  9843.  # It thinks the first close brace ends the variable substitution.
  9844.  test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
  9845.  
  9846. -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
  9847. +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
  9848.  
  9849.  test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
  9850.  
  9851. -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
  9852. -echo "configure:847: checking whether build environment is sane" >&5
  9853. +echo "$as_me:$LINENO: checking whether build environment is sane" >&5
  9854. +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
  9855.  # Just in case
  9856.  sleep 1
  9857. -echo timestamp > conftestfile
  9858. +echo timestamp > conftest.file
  9859.  # Do `set' in a subshell so we don't clobber the current shell's
  9860.  # arguments.  Must try -L first in case configure is actually a
  9861.  # symlink; some systems play weird games with the mod time of symlinks
  9862.  # (eg FreeBSD returns the mod time of the symlink's containing
  9863.  # directory).
  9864.  if (
  9865. -   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
  9866. +   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
  9867.     if test "$*" = "X"; then
  9868.        # -L didn't work.
  9869. -      set X `ls -t $srcdir/configure conftestfile`
  9870. +      set X `ls -t $srcdir/configure conftest.file`
  9871.     fi
  9872. -   if test "$*" != "X $srcdir/configure conftestfile" \
  9873. -      && test "$*" != "X conftestfile $srcdir/configure"; then
  9874. +   rm -f conftest.file
  9875. +   if test "$*" != "X $srcdir/configure conftest.file" \
  9876. +      && test "$*" != "X conftest.file $srcdir/configure"; then
  9877.  
  9878.        # If neither matched, then we have a broken ls.  This can happen
  9879.        # if, for instance, CONFIG_SHELL is bash and it inherits a
  9880.        # broken ls alias from the environment.  This has actually
  9881.        # happened.  Such a system could not be considered "sane".
  9882. -      { echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
  9883. -alias in your environment" 1>&2; exit 1; }
  9884. +      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
  9885. +alias in your environment" >&5
  9886. +echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
  9887. +alias in your environment" >&2;}
  9888. +   { (exit 1); exit 1; }; }
  9889.     fi
  9890.  
  9891. -   test "$2" = conftestfile
  9892. +   test "$2" = conftest.file
  9893.     )
  9894.  then
  9895.     # Ok.
  9896.     :
  9897.  else
  9898. -   { echo "configure: error: newly created file is older than distributed files!
  9899. -Check your system clock" 1>&2; exit 1; }
  9900. +   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
  9901. +Check your system clock" >&5
  9902. +echo "$as_me: error: newly created file is older than distributed files!
  9903. +Check your system clock" >&2;}
  9904. +   { (exit 1); exit 1; }; }
  9905. +fi
  9906. +echo "$as_me:$LINENO: result: yes" >&5
  9907. +echo "${ECHO_T}yes" >&6
  9908. +test "$program_prefix" != NONE &&
  9909. +  program_transform_name="s,^,$program_prefix,;$program_transform_name"
  9910. +# Use a double $ so make ignores it.
  9911. +test "$program_suffix" != NONE &&
  9912. +  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
  9913. +# Double any \ or $.  echo might interpret backslashes.
  9914. +# By default was `s,x,x', remove it if useless.
  9915. +cat <<\_ACEOF >conftest.sed
  9916. +s/[\\$]/&&/g;s/;s,x,x,$//
  9917. +_ACEOF
  9918. +program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
  9919. +rm conftest.sed
  9920. +
  9921. +
  9922. +# expand $ac_aux_dir to an absolute path
  9923. +am_aux_dir=`cd $ac_aux_dir && pwd`
  9924. +
  9925. +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
  9926. +# Use eval to expand $SHELL
  9927. +if eval "$MISSING --run true"; then
  9928. +  am_missing_run="$MISSING --run "
  9929. +else
  9930. +  am_missing_run=
  9931. +  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
  9932. +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
  9933. +fi
  9934. +
  9935. +for ac_prog in gawk mawk nawk awk
  9936. +do
  9937. +  # Extract the first word of "$ac_prog", so it can be a program name with args.
  9938. +set dummy $ac_prog; ac_word=$2
  9939. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  9940. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  9941. +if test "${ac_cv_prog_AWK+set}" = set; then
  9942. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  9943. +else
  9944. +  if test -n "$AWK"; then
  9945. +  ac_cv_prog_AWK="$AWK" # Let the user override the test.
  9946. +else
  9947. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  9948. +for as_dir in $PATH
  9949. +do
  9950. +  IFS=$as_save_IFS
  9951. +  test -z "$as_dir" && as_dir=.
  9952. +  for ac_exec_ext in '' $ac_executable_extensions; do
  9953. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  9954. +    ac_cv_prog_AWK="$ac_prog"
  9955. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  9956. +    break 2
  9957. +  fi
  9958. +done
  9959. +done
  9960. +
  9961.  fi
  9962. -rm -f conftest*
  9963. -echo "$ac_t""yes" 1>&6
  9964. -if test "$program_transform_name" = s,x,x,; then
  9965. -  program_transform_name=
  9966. -else
  9967. -  # Double any \ or $.  echo might interpret backslashes.
  9968. -  cat <<\EOF_SED > conftestsed
  9969. -s,\\,\\\\,g; s,\$,$$,g
  9970. -EOF_SED
  9971. -  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
  9972. -  rm -f conftestsed
  9973.  fi
  9974. -test "$program_prefix" != NONE &&
  9975. -  program_transform_name="s,^,${program_prefix},; $program_transform_name"
  9976. -# Use a double $ so make ignores it.
  9977. -test "$program_suffix" != NONE &&
  9978. -  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
  9979. +AWK=$ac_cv_prog_AWK
  9980. +if test -n "$AWK"; then
  9981. +  echo "$as_me:$LINENO: result: $AWK" >&5
  9982. +echo "${ECHO_T}$AWK" >&6
  9983. +else
  9984. +  echo "$as_me:$LINENO: result: no" >&5
  9985. +echo "${ECHO_T}no" >&6
  9986. +fi
  9987.  
  9988. -# sed with no file args requires a program.
  9989. -test "$program_transform_name" = "" && program_transform_name="s,x,x,"
  9990. +  test -n "$AWK" && break
  9991. +done
  9992.  
  9993. -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
  9994. -echo "configure:904: checking whether ${MAKE-make} sets \${MAKE}" >&5
  9995. -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
  9996. -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
  9997. -  echo $ac_n "(cached) $ac_c" 1>&6
  9998. +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
  9999. +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
  10000. +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
  10001. +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
  10002. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10003.  else
  10004. -  cat > conftestmake <<\EOF
  10005. +  cat >conftest.make <<\_ACEOF
  10006.  all:
  10007. -    @echo 'ac_maketemp="${MAKE}"'
  10008. -EOF
  10009. +    @echo 'ac_maketemp="$(MAKE)"'
  10010. +_ACEOF
  10011.  # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
  10012. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
  10013. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
  10014.  if test -n "$ac_maketemp"; then
  10015.    eval ac_cv_prog_make_${ac_make}_set=yes
  10016.  else
  10017.    eval ac_cv_prog_make_${ac_make}_set=no
  10018.  fi
  10019. -rm -f conftestmake
  10020. +rm -f conftest.make
  10021.  fi
  10022.  if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
  10023. -  echo "$ac_t""yes" 1>&6
  10024. +  echo "$as_me:$LINENO: result: yes" >&5
  10025. +echo "${ECHO_T}yes" >&6
  10026.    SET_MAKE=
  10027.  else
  10028. -  echo "$ac_t""no" 1>&6
  10029. +  echo "$as_me:$LINENO: result: no" >&5
  10030. +echo "${ECHO_T}no" >&6
  10031.    SET_MAKE="MAKE=${MAKE-make}"
  10032.  fi
  10033.  
  10034. +rm -f .deps 2>/dev/null
  10035. +mkdir .deps 2>/dev/null
  10036. +if test -d .deps; then
  10037. +  DEPDIR=.deps
  10038. +else
  10039. +  # MS-DOS does not allow filenames that begin with a dot.
  10040. +  DEPDIR=_deps
  10041. +fi
  10042. +rmdir .deps 2>/dev/null
  10043.  
  10044. -PACKAGE=bfd
  10045.  
  10046. -VERSION=2.14
  10047. +          ac_config_commands="$ac_config_commands depfiles"
  10048.  
  10049. -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  10050. -  { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
  10051. +
  10052. +am_make=${MAKE-make}
  10053. +cat > confinc << 'END'
  10054. +doit:
  10055. +    @echo done
  10056. +END
  10057. +# If we don't find an include directive, just comment out the code.
  10058. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
  10059. +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
  10060. +am__include="#"
  10061. +am__quote=
  10062. +_am_result=none
  10063. +# First try GNU make style include.
  10064. +echo "include confinc" > confmf
  10065. +# We grep out `Entering directory' and `Leaving directory'
  10066. +# messages which can occur if `w' ends up in MAKEFLAGS.
  10067. +# In particular we don't look at `^make:' because GNU make might
  10068. +# be invoked under some other name (usually "gmake"), in which
  10069. +# case it prints its new name instead of `make'.
  10070. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
  10071. +   am__include=include
  10072. +   am__quote=
  10073. +   _am_result=GNU
  10074. +fi
  10075. +# Now try BSD make style include.
  10076. +if test "$am__include" = "#"; then
  10077. +   echo '.include "confinc"' > confmf
  10078. +   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
  10079. +      am__include=.include
  10080. +      am__quote="\""
  10081. +      _am_result=BSD
  10082. +   fi
  10083.  fi
  10084. -cat >> confdefs.h <<EOF
  10085. -#define PACKAGE "$PACKAGE"
  10086. -EOF
  10087.  
  10088. -cat >> confdefs.h <<EOF
  10089. -#define VERSION "$VERSION"
  10090. -EOF
  10091.  
  10092. +echo "$as_me:$LINENO: result: $_am_result" >&5
  10093. +echo "${ECHO_T}$_am_result" >&6
  10094. +rm -f confinc confmf
  10095.  
  10096. +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
  10097. +if test "${enable_dependency_tracking+set}" = set; then
  10098. +  enableval="$enable_dependency_tracking"
  10099.  
  10100. -missing_dir=`cd $ac_aux_dir && pwd`
  10101. -echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
  10102. -echo "configure:950: checking for working aclocal" >&5
  10103. -# Run test in a subshell; some versions of sh will print an error if
  10104. -# an executable is not found, even if stderr is redirected.
  10105. -# Redirect stdin to placate older versions of autoconf.  Sigh.
  10106. -if (aclocal --version) < /dev/null > /dev/null 2>&1; then
  10107. -   ACLOCAL=aclocal
  10108. -   echo "$ac_t""found" 1>&6
  10109. -else
  10110. -   ACLOCAL="$missing_dir/missing aclocal"
  10111. -   echo "$ac_t""missing" 1>&6
  10112. -fi
  10113. -
  10114. -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
  10115. -echo "configure:963: checking for working autoconf" >&5
  10116. -# Run test in a subshell; some versions of sh will print an error if
  10117. -# an executable is not found, even if stderr is redirected.
  10118. -# Redirect stdin to placate older versions of autoconf.  Sigh.
  10119. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then
  10120. -   AUTOCONF=autoconf
  10121. -   echo "$ac_t""found" 1>&6
  10122. -else
  10123. -   AUTOCONF="$missing_dir/missing autoconf"
  10124. -   echo "$ac_t""missing" 1>&6
  10125. -fi
  10126. -
  10127. -echo $ac_n "checking for working automake""... $ac_c" 1>&6
  10128. -echo "configure:976: checking for working automake" >&5
  10129. -# Run test in a subshell; some versions of sh will print an error if
  10130. -# an executable is not found, even if stderr is redirected.
  10131. -# Redirect stdin to placate older versions of autoconf.  Sigh.
  10132. -if (automake --version) < /dev/null > /dev/null 2>&1; then
  10133. -   AUTOMAKE=automake
  10134. -   echo "$ac_t""found" 1>&6
  10135. -else
  10136. -   AUTOMAKE="$missing_dir/missing automake"
  10137. -   echo "$ac_t""missing" 1>&6
  10138. -fi
  10139. -
  10140. -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
  10141. -echo "configure:989: checking for working autoheader" >&5
  10142. -# Run test in a subshell; some versions of sh will print an error if
  10143. -# an executable is not found, even if stderr is redirected.
  10144. -# Redirect stdin to placate older versions of autoconf.  Sigh.
  10145. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then
  10146. -   AUTOHEADER=autoheader
  10147. -   echo "$ac_t""found" 1>&6
  10148. -else
  10149. -   AUTOHEADER="$missing_dir/missing autoheader"
  10150. -   echo "$ac_t""missing" 1>&6
  10151. -fi
  10152. -
  10153. -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
  10154. -echo "configure:1002: checking for working makeinfo" >&5
  10155. -# Run test in a subshell; some versions of sh will print an error if
  10156. -# an executable is not found, even if stderr is redirected.
  10157. -# Redirect stdin to placate older versions of autoconf.  Sigh.
  10158. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
  10159. -   MAKEINFO=makeinfo
  10160. -   echo "$ac_t""found" 1>&6
  10161. -else
  10162. -   MAKEINFO="$missing_dir/missing makeinfo"
  10163. -   echo "$ac_t""missing" 1>&6
  10164. +fi;
  10165. +if test "x$enable_dependency_tracking" != xno; then
  10166. +  am_depcomp="$ac_aux_dir/depcomp"
  10167. +  AMDEPBACKSLASH='\'
  10168.  fi
  10169.  
  10170.  
  10171. -# Uncomment the next line to remove the date from the reported bfd version
  10172. -#is_release=y
  10173. +if test "x$enable_dependency_tracking" != xno; then
  10174. +  AMDEP_TRUE=
  10175. +  AMDEP_FALSE='#'
  10176. +else
  10177. +  AMDEP_TRUE='#'
  10178. +  AMDEP_FALSE=
  10179. +fi
  10180.  
  10181. -bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
  10182.  
  10183. -bfd_version_string="\"${VERSION}\""
  10184. -if test x${is_release} = x; then
  10185. -  bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
  10186. -  bfd_version_string="\"${VERSION} ${bfd_version_date}\""
  10187. +
  10188. + # test to see if srcdir already configured
  10189. +if test "`cd $srcdir && pwd`" != "`pwd`" &&
  10190. +   test -f $srcdir/config.status; then
  10191. +  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
  10192. +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
  10193. +   { (exit 1); exit 1; }; }
  10194.  fi
  10195.  
  10196. +# Define the identity of the package.
  10197. + PACKAGE=bfd
  10198. + VERSION=2.14
  10199.  
  10200.  
  10201. -if test $host != $build; then
  10202. -  ac_tool_prefix=${host_alias}-
  10203. -else
  10204. -  ac_tool_prefix=
  10205. -fi
  10206. +cat >>confdefs.h <<_ACEOF
  10207. +#define PACKAGE "$PACKAGE"
  10208. +_ACEOF
  10209.  
  10210. -# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
  10211. -set dummy ${ac_tool_prefix}ar; ac_word=$2
  10212. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  10213. -echo "configure:1037: checking for $ac_word" >&5
  10214. -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
  10215. -  echo $ac_n "(cached) $ac_c" 1>&6
  10216. -else
  10217. -  if test -n "$AR"; then
  10218. -  ac_cv_prog_AR="$AR" # Let the user override the test.
  10219. -else
  10220. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  10221. -  ac_dummy="$PATH"
  10222. -  for ac_dir in $ac_dummy; do
  10223. -    test -z "$ac_dir" && ac_dir=.
  10224. -    if test -f $ac_dir/$ac_word; then
  10225. -      ac_cv_prog_AR="${ac_tool_prefix}ar"
  10226. -      break
  10227. -    fi
  10228. -  done
  10229. -  IFS="$ac_save_ifs"
  10230. -  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
  10231. -fi
  10232. -fi
  10233. -AR="$ac_cv_prog_AR"
  10234. -if test -n "$AR"; then
  10235. -  echo "$ac_t""$AR" 1>&6
  10236. -else
  10237. -  echo "$ac_t""no" 1>&6
  10238. -fi
  10239.  
  10240. +cat >>confdefs.h <<_ACEOF
  10241. +#define VERSION "$VERSION"
  10242. +_ACEOF
  10243. +
  10244. +# Some tools Automake needs.
  10245.  
  10246. +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
  10247.  
  10248. -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  10249. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2
  10250. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  10251. -echo "configure:1069: checking for $ac_word" >&5
  10252. -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  10253. -  echo $ac_n "(cached) $ac_c" 1>&6
  10254. +
  10255. +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
  10256. +
  10257. +
  10258. +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
  10259. +
  10260. +
  10261. +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
  10262. +
  10263. +
  10264. +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
  10265. +
  10266. +
  10267. +AMTAR=${AMTAR-"${am_missing_run}tar"}
  10268. +
  10269. +install_sh=${install_sh-"$am_aux_dir/install-sh"}
  10270. +
  10271. +# Installed binaries are usually stripped using `strip' when the user
  10272. +# run `make install-strip'.  However `strip' might not be the right
  10273. +# tool to use in cross-compilation environments, therefore Automake
  10274. +# will honor the `STRIP' environment variable to overrule this program.
  10275. +if test "$cross_compiling" != no; then
  10276. +  if test -n "$ac_tool_prefix"; then
  10277. +  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
  10278. +set dummy ${ac_tool_prefix}strip; ac_word=$2
  10279. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  10280. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  10281. +if test "${ac_cv_prog_STRIP+set}" = set; then
  10282. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10283.  else
  10284. -  if test -n "$RANLIB"; then
  10285. -  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  10286. +  if test -n "$STRIP"; then
  10287. +  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
  10288.  else
  10289. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  10290. -  ac_dummy="$PATH"
  10291. -  for ac_dir in $ac_dummy; do
  10292. -    test -z "$ac_dir" && ac_dir=.
  10293. -    if test -f $ac_dir/$ac_word; then
  10294. -      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
  10295. -      break
  10296. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  10297. +for as_dir in $PATH
  10298. +do
  10299. +  IFS=$as_save_IFS
  10300. +  test -z "$as_dir" && as_dir=.
  10301. +  for ac_exec_ext in '' $ac_executable_extensions; do
  10302. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  10303. +    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
  10304. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  10305. +    break 2
  10306.      fi
  10307. -  done
  10308. -  IFS="$ac_save_ifs"
  10309. +done
  10310. +done
  10311. +
  10312.  fi
  10313.  fi
  10314. -RANLIB="$ac_cv_prog_RANLIB"
  10315. -if test -n "$RANLIB"; then
  10316. -  echo "$ac_t""$RANLIB" 1>&6
  10317. +STRIP=$ac_cv_prog_STRIP
  10318. +if test -n "$STRIP"; then
  10319. +  echo "$as_me:$LINENO: result: $STRIP" >&5
  10320. +echo "${ECHO_T}$STRIP" >&6
  10321.  else
  10322. -  echo "$ac_t""no" 1>&6
  10323. +  echo "$as_me:$LINENO: result: no" >&5
  10324. +echo "${ECHO_T}no" >&6
  10325.  fi
  10326.  
  10327. -
  10328. -if test -z "$ac_cv_prog_RANLIB"; then
  10329. -if test -n "$ac_tool_prefix"; then
  10330. -  # Extract the first word of "ranlib", so it can be a program name with args.
  10331. -set dummy ranlib; ac_word=$2
  10332. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  10333. -echo "configure:1101: checking for $ac_word" >&5
  10334. -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  10335. -  echo $ac_n "(cached) $ac_c" 1>&6
  10336. +fi
  10337. +if test -z "$ac_cv_prog_STRIP"; then
  10338. +  ac_ct_STRIP=$STRIP
  10339. +  # Extract the first word of "strip", so it can be a program name with args.
  10340. +set dummy strip; ac_word=$2
  10341. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  10342. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  10343. +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
  10344. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10345.  else
  10346. -  if test -n "$RANLIB"; then
  10347. -  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  10348. +  if test -n "$ac_ct_STRIP"; then
  10349. +  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
  10350.  else
  10351. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  10352. -  ac_dummy="$PATH"
  10353. -  for ac_dir in $ac_dummy; do
  10354. -    test -z "$ac_dir" && ac_dir=.
  10355. -    if test -f $ac_dir/$ac_word; then
  10356. -      ac_cv_prog_RANLIB="ranlib"
  10357. -      break
  10358. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  10359. +for as_dir in $PATH
  10360. +do
  10361. +  IFS=$as_save_IFS
  10362. +  test -z "$as_dir" && as_dir=.
  10363. +  for ac_exec_ext in '' $ac_executable_extensions; do
  10364. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  10365. +    ac_cv_prog_ac_ct_STRIP="strip"
  10366. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  10367. +    break 2
  10368.      fi
  10369. -  done
  10370. -  IFS="$ac_save_ifs"
  10371. -  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
  10372. +done
  10373. +done
  10374. +
  10375. +  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
  10376.  fi
  10377.  fi
  10378. -RANLIB="$ac_cv_prog_RANLIB"
  10379. -if test -n "$RANLIB"; then
  10380. -  echo "$ac_t""$RANLIB" 1>&6
  10381. +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
  10382. +if test -n "$ac_ct_STRIP"; then
  10383. +  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
  10384. +echo "${ECHO_T}$ac_ct_STRIP" >&6
  10385.  else
  10386. -  echo "$ac_t""no" 1>&6
  10387. +  echo "$as_me:$LINENO: result: no" >&5
  10388. +echo "${ECHO_T}no" >&6
  10389.  fi
  10390.  
  10391. +  STRIP=$ac_ct_STRIP
  10392.  else
  10393. -  RANLIB=":"
  10394. +  STRIP="$ac_cv_prog_STRIP"
  10395.  fi
  10396. +
  10397.  fi
  10398. +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
  10399.  
  10400. +# We need awk for the "check" target.  The system "awk" is bad on
  10401. +# some platforms.
  10402.  
  10403. -# Check whether --enable-shared or --disable-shared was given.
  10404. -if test "${enable_shared+set}" = set; then
  10405. -  enableval="$enable_shared"
  10406. -  p=${PACKAGE-default}
  10407. -case $enableval in
  10408. -yes) enable_shared=yes ;;
  10409. -no) enable_shared=no ;;
  10410. -*)
  10411. -  enable_shared=no
  10412. -  # Look at the argument we got.  We use all the common list separators.
  10413. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  10414. -  for pkg in $enableval; do
  10415. -    if test "X$pkg" = "X$p"; then
  10416. -      enable_shared=yes
  10417. -    fi
  10418. -  done
  10419. -  IFS="$ac_save_ifs"
  10420. -  ;;
  10421. -esac
  10422. +
  10423. +depcc="$CC"   am_compiler_list=
  10424. +
  10425. +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
  10426. +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
  10427. +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
  10428. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10429.  else
  10430. -  enable_shared=no
  10431. -fi
  10432. +  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
  10433. +  # We make a subdir and do the tests there.  Otherwise we can end up
  10434. +  # making bogus files that we don't know about and never remove.  For
  10435. +  # instance it was reported that on HP-UX the gcc test will end up
  10436. +  # making a dummy file named `D' -- because `-MD' means `put the output
  10437. +  # in D'.
  10438. +  mkdir conftest.dir
  10439. +  # Copy depcomp to subdir because otherwise we won't find it if we're
  10440. +  # using a relative directory.
  10441. +  cp "$am_depcomp" conftest.dir
  10442. +  cd conftest.dir
  10443.  
  10444. +  am_cv_CC_dependencies_compiler_type=none
  10445. +  if test "$am_compiler_list" = ""; then
  10446. +     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
  10447. +    fi
  10448. +  for depmode in $am_compiler_list; do
  10449. +    # We need to recreate these files for each test, as the compiler may
  10450. +    # overwrite some of them when testing with obscure command lines.
  10451. +    # This happens at least with the AIX C compiler.
  10452. +    echo '#include "conftest.h"' > conftest.c
  10453. +    echo 'int i;' > conftest.h
  10454. +    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
  10455.  
  10456. -# Check whether --enable-static or --disable-static was given.
  10457. -if test "${enable_static+set}" = set; then
  10458. -  enableval="$enable_static"
  10459. -  p=${PACKAGE-default}
  10460. -case $enableval in
  10461. -yes) enable_static=yes ;;
  10462. -no) enable_static=no ;;
  10463. -*)
  10464. -  enable_static=no
  10465. -  # Look at the argument we got.  We use all the common list separators.
  10466. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  10467. -  for pkg in $enableval; do
  10468. -    if test "X$pkg" = "X$p"; then
  10469. -      enable_static=yes
  10470. +    case $depmode in
  10471. +    nosideeffect)
  10472. +      # after this tag, mechanisms are not by side-effect, so they'll
  10473. +      # only be used when explicitly requested
  10474. +      if test "x$enable_dependency_tracking" = xyes; then
  10475. +    continue
  10476. +      else
  10477. +    break
  10478.      fi
  10479. -  done
  10480. -  IFS="$ac_save_ifs"
  10481.    ;;
  10482. -esac
  10483. -else
  10484. -  enable_static=yes
  10485. -fi
  10486. -
  10487. -# Check whether --enable-fast-install or --disable-fast-install was given.
  10488. -if test "${enable_fast_install+set}" = set; then
  10489. -  enableval="$enable_fast_install"
  10490. -  p=${PACKAGE-default}
  10491. -case $enableval in
  10492. -yes) enable_fast_install=yes ;;
  10493. -no) enable_fast_install=no ;;
  10494. -*)
  10495. -  enable_fast_install=no
  10496. -  # Look at the argument we got.  We use all the common list separators.
  10497. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  10498. -  for pkg in $enableval; do
  10499. -    if test "X$pkg" = "X$p"; then
  10500. -      enable_fast_install=yes
  10501. +    none) break ;;
  10502. +  esac
  10503. +    # We check with `-c' and `-o' for the sake of the "dashmstdout"
  10504. +    # mode.  It turns out that the SunPro C++ compiler does not properly
  10505. +    # handle `-M -o', and we need to detect this.
  10506. +    if depmode=$depmode \
  10507. +       source=conftest.c object=conftest.o \
  10508. +       depfile=conftest.Po tmpdepfile=conftest.TPo \
  10509. +       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
  10510. +       grep conftest.h conftest.Po > /dev/null 2>&1 &&
  10511. +       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  10512. +      am_cv_CC_dependencies_compiler_type=$depmode
  10513. +      break
  10514.      fi
  10515.    done
  10516. -  IFS="$ac_save_ifs"
  10517. -  ;;
  10518. -esac
  10519. +
  10520. +  cd ..
  10521. +  rm -rf conftest.dir
  10522.  else
  10523. -  enable_fast_install=yes
  10524. +  am_cv_CC_dependencies_compiler_type=none
  10525.  fi
  10526.  
  10527. -# Extract the first word of "gcc", so it can be a program name with args.
  10528. -set dummy gcc; ac_word=$2
  10529. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  10530. -echo "configure:1207: checking for $ac_word" >&5
  10531. -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  10532. -  echo $ac_n "(cached) $ac_c" 1>&6
  10533. +fi
  10534. +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
  10535. +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
  10536. +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
  10537. +
  10538. +
  10539. +
  10540. +# Uncomment the next line to remove the date from the reported bfd version
  10541. +#is_release=y
  10542. +
  10543. +bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
  10544. +
  10545. +bfd_version_string="\"${VERSION}\""
  10546. +if test x${is_release} = x; then
  10547. +  bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
  10548. +  bfd_version_string="\"${VERSION} ${bfd_version_date} (Amiga, Inc. build 20031201)\""
  10549. +fi
  10550. +
  10551. +
  10552. +
  10553. +if test -n "$ac_tool_prefix"; then
  10554. +  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
  10555. +set dummy ${ac_tool_prefix}ar; ac_word=$2
  10556. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  10557. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  10558. +if test "${ac_cv_prog_AR+set}" = set; then
  10559. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10560.  else
  10561. -  if test -n "$CC"; then
  10562. -  ac_cv_prog_CC="$CC" # Let the user override the test.
  10563. +  if test -n "$AR"; then
  10564. +  ac_cv_prog_AR="$AR" # Let the user override the test.
  10565.  else
  10566. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  10567. -  ac_dummy="$PATH"
  10568. -  for ac_dir in $ac_dummy; do
  10569. -    test -z "$ac_dir" && ac_dir=.
  10570. -    if test -f $ac_dir/$ac_word; then
  10571. -      ac_cv_prog_CC="gcc"
  10572. -      break
  10573. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  10574. +for as_dir in $PATH
  10575. +do
  10576. +  IFS=$as_save_IFS
  10577. +  test -z "$as_dir" && as_dir=.
  10578. +  for ac_exec_ext in '' $ac_executable_extensions; do
  10579. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  10580. +    ac_cv_prog_AR="${ac_tool_prefix}ar"
  10581. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  10582. +    break 2
  10583.      fi
  10584. -  done
  10585. -  IFS="$ac_save_ifs"
  10586. +done
  10587. +done
  10588. +
  10589.  fi
  10590.  fi
  10591. -CC="$ac_cv_prog_CC"
  10592. -if test -n "$CC"; then
  10593. -  echo "$ac_t""$CC" 1>&6
  10594. +AR=$ac_cv_prog_AR
  10595. +if test -n "$AR"; then
  10596. +  echo "$as_me:$LINENO: result: $AR" >&5
  10597. +echo "${ECHO_T}$AR" >&6
  10598.  else
  10599. -  echo "$ac_t""no" 1>&6
  10600. +  echo "$as_me:$LINENO: result: no" >&5
  10601. +echo "${ECHO_T}no" >&6
  10602.  fi
  10603.  
  10604. -if test -z "$CC"; then
  10605. -  # Extract the first word of "cc", so it can be a program name with args.
  10606. -set dummy cc; ac_word=$2
  10607. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  10608. -echo "configure:1237: checking for $ac_word" >&5
  10609. -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  10610. -  echo $ac_n "(cached) $ac_c" 1>&6
  10611. +fi
  10612. +if test -z "$ac_cv_prog_AR"; then
  10613. +  ac_ct_AR=$AR
  10614. +  # Extract the first word of "ar", so it can be a program name with args.
  10615. +set dummy ar; ac_word=$2
  10616. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  10617. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  10618. +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
  10619. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10620.  else
  10621. -  if test -n "$CC"; then
  10622. -  ac_cv_prog_CC="$CC" # Let the user override the test.
  10623. +  if test -n "$ac_ct_AR"; then
  10624. +  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
  10625.  else
  10626. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  10627. -  ac_prog_rejected=no
  10628. -  ac_dummy="$PATH"
  10629. -  for ac_dir in $ac_dummy; do
  10630. -    test -z "$ac_dir" && ac_dir=.
  10631. -    if test -f $ac_dir/$ac_word; then
  10632. -      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
  10633. -        ac_prog_rejected=yes
  10634. -    continue
  10635. -      fi
  10636. -      ac_cv_prog_CC="cc"
  10637. -      break
  10638. -    fi
  10639. -  done
  10640. -  IFS="$ac_save_ifs"
  10641. -if test $ac_prog_rejected = yes; then
  10642. -  # We found a bogon in the path, so make sure we never use it.
  10643. -  set dummy $ac_cv_prog_CC
  10644. -  shift
  10645. -  if test $# -gt 0; then
  10646. -    # We chose a different compiler from the bogus one.
  10647. -    # However, it has the same basename, so the bogon will be chosen
  10648. -    # first if we set CC to just the basename; use the full file name.
  10649. -    shift
  10650. -    set dummy "$ac_dir/$ac_word" "$@"
  10651. -    shift
  10652. -    ac_cv_prog_CC="$@"
  10653. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  10654. +for as_dir in $PATH
  10655. +do
  10656. +  IFS=$as_save_IFS
  10657. +  test -z "$as_dir" && as_dir=.
  10658. +  for ac_exec_ext in '' $ac_executable_extensions; do
  10659. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  10660. +    ac_cv_prog_ac_ct_AR="ar"
  10661. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  10662. +    break 2
  10663.    fi
  10664. +done
  10665. +done
  10666. +
  10667.  fi
  10668.  fi
  10669. +ac_ct_AR=$ac_cv_prog_ac_ct_AR
  10670. +if test -n "$ac_ct_AR"; then
  10671. +  echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
  10672. +echo "${ECHO_T}$ac_ct_AR" >&6
  10673. +else
  10674. +  echo "$as_me:$LINENO: result: no" >&5
  10675. +echo "${ECHO_T}no" >&6
  10676.  fi
  10677. -CC="$ac_cv_prog_CC"
  10678. -if test -n "$CC"; then
  10679. -  echo "$ac_t""$CC" 1>&6
  10680. +
  10681. +  AR=$ac_ct_AR
  10682.  else
  10683. -  echo "$ac_t""no" 1>&6
  10684. +  AR="$ac_cv_prog_AR"
  10685.  fi
  10686.  
  10687. -  if test -z "$CC"; then
  10688. -    case "`uname -s`" in
  10689. -    *win32* | *WIN32*)
  10690. -      # Extract the first word of "cl", so it can be a program name with args.
  10691. -set dummy cl; ac_word=$2
  10692. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  10693. -echo "configure:1288: checking for $ac_word" >&5
  10694. -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  10695. -  echo $ac_n "(cached) $ac_c" 1>&6
  10696. +if test -n "$ac_tool_prefix"; then
  10697. +  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  10698. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2
  10699. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  10700. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  10701. +if test "${ac_cv_prog_RANLIB+set}" = set; then
  10702. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10703.  else
  10704. -  if test -n "$CC"; then
  10705. -  ac_cv_prog_CC="$CC" # Let the user override the test.
  10706. +  if test -n "$RANLIB"; then
  10707. +  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  10708.  else
  10709. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  10710. -  ac_dummy="$PATH"
  10711. -  for ac_dir in $ac_dummy; do
  10712. -    test -z "$ac_dir" && ac_dir=.
  10713. -    if test -f $ac_dir/$ac_word; then
  10714. -      ac_cv_prog_CC="cl"
  10715. -      break
  10716. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  10717. +for as_dir in $PATH
  10718. +do
  10719. +  IFS=$as_save_IFS
  10720. +  test -z "$as_dir" && as_dir=.
  10721. +  for ac_exec_ext in '' $ac_executable_extensions; do
  10722. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  10723. +    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
  10724. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  10725. +    break 2
  10726.      fi
  10727. -  done
  10728. -  IFS="$ac_save_ifs"
  10729. +done
  10730. +done
  10731. +
  10732.  fi
  10733.  fi
  10734. -CC="$ac_cv_prog_CC"
  10735. -if test -n "$CC"; then
  10736. -  echo "$ac_t""$CC" 1>&6
  10737. +RANLIB=$ac_cv_prog_RANLIB
  10738. +if test -n "$RANLIB"; then
  10739. +  echo "$as_me:$LINENO: result: $RANLIB" >&5
  10740. +echo "${ECHO_T}$RANLIB" >&6
  10741.  else
  10742. -  echo "$ac_t""no" 1>&6
  10743. -fi
  10744. - ;;
  10745. -    esac
  10746. -  fi
  10747. -  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
  10748. +  echo "$as_me:$LINENO: result: no" >&5
  10749. +echo "${ECHO_T}no" >&6
  10750.  fi
  10751.  
  10752. -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
  10753. -echo "configure:1320: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
  10754. -
  10755. -ac_ext=c
  10756. -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  10757. -ac_cpp='$CPP $CPPFLAGS'
  10758. -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  10759. -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  10760. -cross_compiling=$ac_cv_prog_cc_cross
  10761. -
  10762. -cat > conftest.$ac_ext << EOF
  10763. -
  10764. -#line 1331 "configure"
  10765. -#include "confdefs.h"
  10766. -
  10767. -main(){return(0);}
  10768. -EOF
  10769. -if { (eval echo configure:1336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  10770. -  ac_cv_prog_cc_works=yes
  10771. -  # If we can't run a trivial program, we are probably using a cross compiler.
  10772. -  if (./conftest; exit) 2>/dev/null; then
  10773. -    ac_cv_prog_cc_cross=no
  10774. -  else
  10775. -    ac_cv_prog_cc_cross=yes
  10776. -  fi
  10777. -else
  10778. -  echo "configure: failed program was:" >&5
  10779. -  cat conftest.$ac_ext >&5
  10780. -  ac_cv_prog_cc_works=no
  10781.  fi
  10782. -rm -fr conftest*
  10783. -ac_ext=c
  10784. -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  10785. -ac_cpp='$CPP $CPPFLAGS'
  10786. -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  10787. -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  10788. -cross_compiling=$ac_cv_prog_cc_cross
  10789. -
  10790. -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
  10791. -if test $ac_cv_prog_cc_works = no; then
  10792. -  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
  10793. -fi
  10794. -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
  10795. -echo "configure:1362: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
  10796. -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
  10797. -cross_compiling=$ac_cv_prog_cc_cross
  10798. -
  10799. -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
  10800. -echo "configure:1367: checking whether we are using GNU C" >&5
  10801. -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
  10802. -  echo $ac_n "(cached) $ac_c" 1>&6
  10803. +if test -z "$ac_cv_prog_RANLIB"; then
  10804. +  ac_ct_RANLIB=$RANLIB
  10805. +  # Extract the first word of "ranlib", so it can be a program name with args.
  10806. +set dummy ranlib; ac_word=$2
  10807. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  10808. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  10809. +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
  10810. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10811.  else
  10812. -  cat > conftest.c <<EOF
  10813. -#ifdef __GNUC__
  10814. -  yes;
  10815. -#endif
  10816. -EOF
  10817. -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
  10818. -  ac_cv_prog_gcc=yes
  10819. +  if test -n "$ac_ct_RANLIB"; then
  10820. +  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
  10821.  else
  10822. -  ac_cv_prog_gcc=no
  10823. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  10824. +for as_dir in $PATH
  10825. +do
  10826. +  IFS=$as_save_IFS
  10827. +  test -z "$as_dir" && as_dir=.
  10828. +  for ac_exec_ext in '' $ac_executable_extensions; do
  10829. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  10830. +    ac_cv_prog_ac_ct_RANLIB="ranlib"
  10831. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  10832. +    break 2
  10833. +  fi
  10834. +done
  10835. +done
  10836. +
  10837. +  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
  10838.  fi
  10839.  fi
  10840. -
  10841. -echo "$ac_t""$ac_cv_prog_gcc" 1>&6
  10842. -
  10843. -if test $ac_cv_prog_gcc = yes; then
  10844. -  GCC=yes
  10845. +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
  10846. +if test -n "$ac_ct_RANLIB"; then
  10847. +  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
  10848. +echo "${ECHO_T}$ac_ct_RANLIB" >&6
  10849.  else
  10850. -  GCC=
  10851. +  echo "$as_me:$LINENO: result: no" >&5
  10852. +echo "${ECHO_T}no" >&6
  10853.  fi
  10854.  
  10855. -ac_test_CFLAGS="${CFLAGS+set}"
  10856. -ac_save_CFLAGS="$CFLAGS"
  10857. -CFLAGS=
  10858. -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
  10859. -echo "configure:1395: checking whether ${CC-cc} accepts -g" >&5
  10860. -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
  10861. -  echo $ac_n "(cached) $ac_c" 1>&6
  10862. +  RANLIB=$ac_ct_RANLIB
  10863.  else
  10864. -  echo 'void f(){}' > conftest.c
  10865. -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
  10866. -  ac_cv_prog_cc_g=yes
  10867. -else
  10868. -  ac_cv_prog_cc_g=no
  10869. +  RANLIB="$ac_cv_prog_RANLIB"
  10870.  fi
  10871. -rm -f conftest*
  10872.  
  10873. -fi
  10874.  
  10875. -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
  10876. -if test "$ac_test_CFLAGS" = set; then
  10877. -  CFLAGS="$ac_save_CFLAGS"
  10878. -elif test $ac_cv_prog_cc_g = yes; then
  10879. -  if test "$GCC" = yes; then
  10880. -    CFLAGS="-g -O2"
  10881. -  else
  10882. -    CFLAGS="-g"
  10883. +# Check whether --enable-shared or --disable-shared was given.
  10884. +if test "${enable_shared+set}" = set; then
  10885. +  enableval="$enable_shared"
  10886. +  p=${PACKAGE-default}
  10887. +case $enableval in
  10888. +yes) enable_shared=yes ;;
  10889. +no) enable_shared=no ;;
  10890. +*)
  10891. +  enable_shared=no
  10892. +  # Look at the argument we got.  We use all the common list separators.
  10893. +  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  10894. +  for pkg in $enableval; do
  10895. +    if test "X$pkg" = "X$p"; then
  10896. +      enable_shared=yes
  10897.    fi
  10898. +  done
  10899. +  IFS="$ac_save_ifs"
  10900. +  ;;
  10901. +esac
  10902.  else
  10903. -  if test "$GCC" = yes; then
  10904. -    CFLAGS="-O2"
  10905. -  else
  10906. -    CFLAGS=
  10907. +  enable_shared=no
  10908. +fi;
  10909. +
  10910. +# Check whether --enable-static or --disable-static was given.
  10911. +if test "${enable_static+set}" = set; then
  10912. +  enableval="$enable_static"
  10913. +  p=${PACKAGE-default}
  10914. +case $enableval in
  10915. +yes) enable_static=yes ;;
  10916. +no) enable_static=no ;;
  10917. +*)
  10918. +  enable_static=no
  10919. +  # Look at the argument we got.  We use all the common list separators.
  10920. +  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  10921. +  for pkg in $enableval; do
  10922. +    if test "X$pkg" = "X$p"; then
  10923. +      enable_static=yes
  10924.    fi
  10925. -fi
  10926. +  done
  10927. +  IFS="$ac_save_ifs"
  10928. +  ;;
  10929. +esac
  10930. +else
  10931. +  enable_static=yes
  10932. +fi;
  10933. +# Check whether --enable-fast-install or --disable-fast-install was given.
  10934. +if test "${enable_fast_install+set}" = set; then
  10935. +  enableval="$enable_fast_install"
  10936. +  p=${PACKAGE-default}
  10937. +case $enableval in
  10938. +yes) enable_fast_install=yes ;;
  10939. +no) enable_fast_install=no ;;
  10940. +*)
  10941. +  enable_fast_install=no
  10942. +  # Look at the argument we got.  We use all the common list separators.
  10943. +  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  10944. +  for pkg in $enableval; do
  10945. +    if test "X$pkg" = "X$p"; then
  10946. +      enable_fast_install=yes
  10947. +    fi
  10948. +  done
  10949. +  IFS="$ac_save_ifs"
  10950. +  ;;
  10951. +esac
  10952. +else
  10953. +  enable_fast_install=yes
  10954. +fi;
  10955.  
  10956.  # Check whether --with-gnu-ld or --without-gnu-ld was given.
  10957.  if test "${with_gnu_ld+set}" = set; then
  10958. @@ -1428,13 +3071,12 @@
  10959.    test "$withval" = no || with_gnu_ld=yes
  10960.  else
  10961.    with_gnu_ld=no
  10962. -fi
  10963. -
  10964. +fi;
  10965.  ac_prog=ld
  10966.  if test "$GCC" = yes; then
  10967.    # Check if gcc -print-prog-name=ld gives a path.
  10968. -  echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
  10969. -echo "configure:1438: checking for ld used by GCC" >&5
  10970. +  echo "$as_me:$LINENO: checking for ld used by GCC" >&5
  10971. +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6
  10972.    case $host in
  10973.    *-*-mingw*)
  10974.      # gcc leaves a trailing carriage return which upsets mingw
  10975. @@ -1463,14 +3105,14 @@
  10976.      ;;
  10977.    esac
  10978.  elif test "$with_gnu_ld" = yes; then
  10979. -  echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
  10980. -echo "configure:1468: checking for GNU ld" >&5
  10981. +  echo "$as_me:$LINENO: checking for GNU ld" >&5
  10982. +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
  10983.  else
  10984. -  echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
  10985. -echo "configure:1471: checking for non-GNU ld" >&5
  10986. +  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
  10987. +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
  10988.  fi
  10989. -if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
  10990. -  echo $ac_n "(cached) $ac_c" 1>&6
  10991. +if test "${lt_cv_path_LD+set}" = set; then
  10992. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  10993.  else
  10994.    if test -z "$LD"; then
  10995.    IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
  10996. @@ -1496,15 +3138,19 @@
  10997.  
  10998.  LD="$lt_cv_path_LD"
  10999.  if test -n "$LD"; then
  11000. -  echo "$ac_t""$LD" 1>&6
  11001. +  echo "$as_me:$LINENO: result: $LD" >&5
  11002. +echo "${ECHO_T}$LD" >&6
  11003.  else
  11004. -  echo "$ac_t""no" 1>&6
  11005. +  echo "$as_me:$LINENO: result: no" >&5
  11006. +echo "${ECHO_T}no" >&6
  11007.  fi
  11008. -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
  11009. -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
  11010. -echo "configure:1506: checking if the linker ($LD) is GNU ld" >&5
  11011. -if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
  11012. -  echo $ac_n "(cached) $ac_c" 1>&6
  11013. +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
  11014. +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
  11015. +   { (exit 1); exit 1; }; }
  11016. +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
  11017. +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
  11018. +if test "${lt_cv_prog_gnu_ld+set}" = set; then
  11019. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11020.  else
  11021.    # I'd rather use --version here, but apparently some GNU ld's only accept -v.
  11022.  if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
  11023. @@ -1513,27 +3159,27 @@
  11024.    lt_cv_prog_gnu_ld=no
  11025.  fi
  11026.  fi
  11027. -
  11028. -echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
  11029. +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
  11030. +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
  11031.  with_gnu_ld=$lt_cv_prog_gnu_ld
  11032.  
  11033.  
  11034. -echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
  11035. -echo "configure:1523: checking for $LD option to reload object files" >&5
  11036. -if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
  11037. -  echo $ac_n "(cached) $ac_c" 1>&6
  11038. +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
  11039. +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
  11040. +if test "${lt_cv_ld_reload_flag+set}" = set; then
  11041. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11042.  else
  11043.    lt_cv_ld_reload_flag='-r'
  11044.  fi
  11045. -
  11046. -echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
  11047. +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
  11048. +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
  11049.  reload_flag=$lt_cv_ld_reload_flag
  11050.  test -n "$reload_flag" && reload_flag=" $reload_flag"
  11051.  
  11052. -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
  11053. -echo "configure:1535: checking for BSD-compatible nm" >&5
  11054. -if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
  11055. -  echo $ac_n "(cached) $ac_c" 1>&6
  11056. +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
  11057. +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
  11058. +if test "${lt_cv_path_NM+set}" = set; then
  11059. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11060.  else
  11061.    if test -n "$NM"; then
  11062.    # Let the user override the test.
  11063. @@ -1566,33 +3212,24 @@
  11064.  fi
  11065.  
  11066.  NM="$lt_cv_path_NM"
  11067. -echo "$ac_t""$NM" 1>&6
  11068. -
  11069. -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
  11070. -echo "configure:1573: checking whether ln -s works" >&5
  11071. -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
  11072. -  echo $ac_n "(cached) $ac_c" 1>&6
  11073. -else
  11074. -  rm -f conftestdata
  11075. -if ln -s X conftestdata 2>/dev/null
  11076. -then
  11077. -  rm -f conftestdata
  11078. -  ac_cv_prog_LN_S="ln -s"
  11079. -else
  11080. -  ac_cv_prog_LN_S=ln
  11081. -fi
  11082. -fi
  11083. -LN_S="$ac_cv_prog_LN_S"
  11084. -if test "$ac_cv_prog_LN_S" = "ln -s"; then
  11085. -  echo "$ac_t""yes" 1>&6
  11086. -else
  11087. -  echo "$ac_t""no" 1>&6
  11088. -fi
  11089. +echo "$as_me:$LINENO: result: $NM" >&5
  11090. +echo "${ECHO_T}$NM" >&6
  11091.  
  11092. -echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
  11093. -echo "configure:1594: checking how to recognise dependant libraries" >&5
  11094. -if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
  11095. -  echo $ac_n "(cached) $ac_c" 1>&6
  11096. +echo "$as_me:$LINENO: checking whether ln -s works" >&5
  11097. +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
  11098. +LN_S=$as_ln_s
  11099. +if test "$LN_S" = "ln -s"; then
  11100. +  echo "$as_me:$LINENO: result: yes" >&5
  11101. +echo "${ECHO_T}yes" >&6
  11102. +else
  11103. +  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
  11104. +echo "${ECHO_T}no, using $LN_S" >&6
  11105. +fi
  11106. +
  11107. +echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5
  11108. +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6
  11109. +if test "${lt_cv_deplibs_check_method+set}" = set; then
  11110. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11111.  else
  11112.    lt_cv_file_magic_cmd='$MAGIC_CMD'
  11113.  lt_cv_file_magic_test_file=
  11114. @@ -1757,67 +3394,13 @@
  11115.  esac
  11116.  
  11117.  fi
  11118. -
  11119. -echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
  11120. +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
  11121. +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
  11122.  file_magic_cmd=$lt_cv_file_magic_cmd
  11123.  deplibs_check_method=$lt_cv_deplibs_check_method
  11124.  
  11125. -echo $ac_n "checking for object suffix""... $ac_c" 1>&6
  11126. -echo "configure:1767: checking for object suffix" >&5
  11127. -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
  11128. -  echo $ac_n "(cached) $ac_c" 1>&6
  11129. -else
  11130. -  rm -f conftest*
  11131. -echo 'int i = 1;' > conftest.$ac_ext
  11132. -if { (eval echo configure:1773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  11133. -  for ac_file in conftest.*; do
  11134. -    case $ac_file in
  11135. -    *.c) ;;
  11136. -    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
  11137. -    esac
  11138. -  done
  11139. -else
  11140. -  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
  11141. -fi
  11142. -rm -f conftest*
  11143. -fi
  11144. -
  11145. -echo "$ac_t""$ac_cv_objext" 1>&6
  11146. -OBJEXT=$ac_cv_objext
  11147. -ac_objext=$ac_cv_objext
  11148. -
  11149. -
  11150.  
  11151. -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
  11152. -echo "configure:1793: checking for executable suffix" >&5
  11153. -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
  11154. -  echo $ac_n "(cached) $ac_c" 1>&6
  11155. -else
  11156. -  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
  11157. -  ac_cv_exeext=.exe
  11158. -else
  11159. -  rm -f conftest*
  11160. -  echo 'int main () { return 0; }' > conftest.$ac_ext
  11161. -  ac_cv_exeext=
  11162. -  if { (eval echo configure:1803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
  11163. -    for file in conftest.*; do
  11164. -      case $file in
  11165. -      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
  11166. -      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
  11167. -      esac
  11168. -    done
  11169. -  else
  11170. -    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
  11171. -  fi
  11172. -  rm -f conftest*
  11173. -  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
  11174. -fi
  11175. -fi
  11176.  
  11177. -EXEEXT=""
  11178. -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
  11179. -echo "$ac_t""${ac_cv_exeext}" 1>&6
  11180. -ac_exeext=$EXEEXT
  11181.  
  11182.  # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
  11183.  
  11184. @@ -1825,10 +3408,10 @@
  11185.  case $deplibs_check_method in
  11186.  file_magic*)
  11187.    if test "$file_magic_cmd" = '$MAGIC_CMD'; then
  11188. -    echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
  11189. -echo "configure:1830: checking for ${ac_tool_prefix}file" >&5
  11190. -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
  11191. -  echo $ac_n "(cached) $ac_c" 1>&6
  11192. +    echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
  11193. +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
  11194. +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
  11195. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11196.  else
  11197.    case $MAGIC_CMD in
  11198.    /*)
  11199. @@ -1880,17 +3463,19 @@
  11200.  
  11201.  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
  11202.  if test -n "$MAGIC_CMD"; then
  11203. -  echo "$ac_t""$MAGIC_CMD" 1>&6
  11204. +  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
  11205. +echo "${ECHO_T}$MAGIC_CMD" >&6
  11206.  else
  11207. -  echo "$ac_t""no" 1>&6
  11208. +  echo "$as_me:$LINENO: result: no" >&5
  11209. +echo "${ECHO_T}no" >&6
  11210.  fi
  11211.  
  11212.  if test -z "$lt_cv_path_MAGIC_CMD"; then
  11213.    if test -n "$ac_tool_prefix"; then
  11214. -    echo $ac_n "checking for file""... $ac_c" 1>&6
  11215. -echo "configure:1892: checking for file" >&5
  11216. -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
  11217. -  echo $ac_n "(cached) $ac_c" 1>&6
  11218. +    echo "$as_me:$LINENO: checking for file" >&5
  11219. +echo $ECHO_N "checking for file... $ECHO_C" >&6
  11220. +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
  11221. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11222.  else
  11223.    case $MAGIC_CMD in
  11224.    /*)
  11225. @@ -1942,9 +3527,11 @@
  11226.  
  11227.  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
  11228.  if test -n "$MAGIC_CMD"; then
  11229. -  echo "$ac_t""$MAGIC_CMD" 1>&6
  11230. +  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
  11231. +echo "${ECHO_T}$MAGIC_CMD" >&6
  11232.  else
  11233. -  echo "$ac_t""no" 1>&6
  11234. +  echo "$as_me:$LINENO: result: no" >&5
  11235. +echo "${ECHO_T}no" >&6
  11236.  fi
  11237.  
  11238.    else
  11239. @@ -1956,138 +3543,164 @@
  11240.    ;;
  11241.  esac
  11242.  
  11243. -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  11244. +if test -n "$ac_tool_prefix"; then
  11245. +  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  11246.  set dummy ${ac_tool_prefix}ranlib; ac_word=$2
  11247. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  11248. -echo "configure:1963: checking for $ac_word" >&5
  11249. -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  11250. -  echo $ac_n "(cached) $ac_c" 1>&6
  11251. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  11252. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  11253. +if test "${ac_cv_prog_RANLIB+set}" = set; then
  11254. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11255.  else
  11256.    if test -n "$RANLIB"; then
  11257.    ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  11258.  else
  11259. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  11260. -  ac_dummy="$PATH"
  11261. -  for ac_dir in $ac_dummy; do
  11262. -    test -z "$ac_dir" && ac_dir=.
  11263. -    if test -f $ac_dir/$ac_word; then
  11264. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  11265. +for as_dir in $PATH
  11266. +do
  11267. +  IFS=$as_save_IFS
  11268. +  test -z "$as_dir" && as_dir=.
  11269. +  for ac_exec_ext in '' $ac_executable_extensions; do
  11270. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  11271.        ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
  11272. -      break
  11273. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  11274. +    break 2
  11275.      fi
  11276. -  done
  11277. -  IFS="$ac_save_ifs"
  11278. +done
  11279. +done
  11280. +
  11281.  fi
  11282.  fi
  11283. -RANLIB="$ac_cv_prog_RANLIB"
  11284. +RANLIB=$ac_cv_prog_RANLIB
  11285.  if test -n "$RANLIB"; then
  11286. -  echo "$ac_t""$RANLIB" 1>&6
  11287. +  echo "$as_me:$LINENO: result: $RANLIB" >&5
  11288. +echo "${ECHO_T}$RANLIB" >&6
  11289.  else
  11290. -  echo "$ac_t""no" 1>&6
  11291. +  echo "$as_me:$LINENO: result: no" >&5
  11292. +echo "${ECHO_T}no" >&6
  11293.  fi
  11294.  
  11295. -
  11296. +fi
  11297.  if test -z "$ac_cv_prog_RANLIB"; then
  11298. -if test -n "$ac_tool_prefix"; then
  11299. +  ac_ct_RANLIB=$RANLIB
  11300.    # Extract the first word of "ranlib", so it can be a program name with args.
  11301.  set dummy ranlib; ac_word=$2
  11302. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  11303. -echo "configure:1995: checking for $ac_word" >&5
  11304. -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  11305. -  echo $ac_n "(cached) $ac_c" 1>&6
  11306. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  11307. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  11308. +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
  11309. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11310.  else
  11311. -  if test -n "$RANLIB"; then
  11312. -  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  11313. +  if test -n "$ac_ct_RANLIB"; then
  11314. +  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
  11315.  else
  11316. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  11317. -  ac_dummy="$PATH"
  11318. -  for ac_dir in $ac_dummy; do
  11319. -    test -z "$ac_dir" && ac_dir=.
  11320. -    if test -f $ac_dir/$ac_word; then
  11321. -      ac_cv_prog_RANLIB="ranlib"
  11322. -      break
  11323. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  11324. +for as_dir in $PATH
  11325. +do
  11326. +  IFS=$as_save_IFS
  11327. +  test -z "$as_dir" && as_dir=.
  11328. +  for ac_exec_ext in '' $ac_executable_extensions; do
  11329. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  11330. +    ac_cv_prog_ac_ct_RANLIB="ranlib"
  11331. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  11332. +    break 2
  11333.      fi
  11334. -  done
  11335. -  IFS="$ac_save_ifs"
  11336. -  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
  11337. +done
  11338. +done
  11339. +
  11340. +  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
  11341.  fi
  11342.  fi
  11343. -RANLIB="$ac_cv_prog_RANLIB"
  11344. -if test -n "$RANLIB"; then
  11345. -  echo "$ac_t""$RANLIB" 1>&6
  11346. +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
  11347. +if test -n "$ac_ct_RANLIB"; then
  11348. +  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
  11349. +echo "${ECHO_T}$ac_ct_RANLIB" >&6
  11350.  else
  11351. -  echo "$ac_t""no" 1>&6
  11352. +  echo "$as_me:$LINENO: result: no" >&5
  11353. +echo "${ECHO_T}no" >&6
  11354.  fi
  11355.  
  11356. +  RANLIB=$ac_ct_RANLIB
  11357.  else
  11358. -  RANLIB=":"
  11359. -fi
  11360. +  RANLIB="$ac_cv_prog_RANLIB"
  11361.  fi
  11362.  
  11363. -# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
  11364. +if test -n "$ac_tool_prefix"; then
  11365. +  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
  11366.  set dummy ${ac_tool_prefix}strip; ac_word=$2
  11367. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  11368. -echo "configure:2030: checking for $ac_word" >&5
  11369. -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
  11370. -  echo $ac_n "(cached) $ac_c" 1>&6
  11371. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  11372. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  11373. +if test "${ac_cv_prog_STRIP+set}" = set; then
  11374. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11375.  else
  11376.    if test -n "$STRIP"; then
  11377.    ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
  11378.  else
  11379. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  11380. -  ac_dummy="$PATH"
  11381. -  for ac_dir in $ac_dummy; do
  11382. -    test -z "$ac_dir" && ac_dir=.
  11383. -    if test -f $ac_dir/$ac_word; then
  11384. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  11385. +for as_dir in $PATH
  11386. +do
  11387. +  IFS=$as_save_IFS
  11388. +  test -z "$as_dir" && as_dir=.
  11389. +  for ac_exec_ext in '' $ac_executable_extensions; do
  11390. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  11391.        ac_cv_prog_STRIP="${ac_tool_prefix}strip"
  11392. -      break
  11393. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  11394. +    break 2
  11395.      fi
  11396. -  done
  11397. -  IFS="$ac_save_ifs"
  11398. +done
  11399. +done
  11400. +
  11401.  fi
  11402.  fi
  11403. -STRIP="$ac_cv_prog_STRIP"
  11404. +STRIP=$ac_cv_prog_STRIP
  11405.  if test -n "$STRIP"; then
  11406. -  echo "$ac_t""$STRIP" 1>&6
  11407. +  echo "$as_me:$LINENO: result: $STRIP" >&5
  11408. +echo "${ECHO_T}$STRIP" >&6
  11409.  else
  11410. -  echo "$ac_t""no" 1>&6
  11411. +  echo "$as_me:$LINENO: result: no" >&5
  11412. +echo "${ECHO_T}no" >&6
  11413.  fi
  11414.  
  11415. -
  11416. +fi
  11417.  if test -z "$ac_cv_prog_STRIP"; then
  11418. -if test -n "$ac_tool_prefix"; then
  11419. +  ac_ct_STRIP=$STRIP
  11420.    # Extract the first word of "strip", so it can be a program name with args.
  11421.  set dummy strip; ac_word=$2
  11422. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  11423. -echo "configure:2062: checking for $ac_word" >&5
  11424. -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
  11425. -  echo $ac_n "(cached) $ac_c" 1>&6
  11426. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  11427. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  11428. +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
  11429. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11430.  else
  11431. -  if test -n "$STRIP"; then
  11432. -  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
  11433. +  if test -n "$ac_ct_STRIP"; then
  11434. +  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
  11435.  else
  11436. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  11437. -  ac_dummy="$PATH"
  11438. -  for ac_dir in $ac_dummy; do
  11439. -    test -z "$ac_dir" && ac_dir=.
  11440. -    if test -f $ac_dir/$ac_word; then
  11441. -      ac_cv_prog_STRIP="strip"
  11442. -      break
  11443. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  11444. +for as_dir in $PATH
  11445. +do
  11446. +  IFS=$as_save_IFS
  11447. +  test -z "$as_dir" && as_dir=.
  11448. +  for ac_exec_ext in '' $ac_executable_extensions; do
  11449. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  11450. +    ac_cv_prog_ac_ct_STRIP="strip"
  11451. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  11452. +    break 2
  11453.      fi
  11454. -  done
  11455. -  IFS="$ac_save_ifs"
  11456. -  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
  11457. +done
  11458. +done
  11459. +
  11460. +  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
  11461.  fi
  11462.  fi
  11463. -STRIP="$ac_cv_prog_STRIP"
  11464. -if test -n "$STRIP"; then
  11465. -  echo "$ac_t""$STRIP" 1>&6
  11466. +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
  11467. +if test -n "$ac_ct_STRIP"; then
  11468. +  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
  11469. +echo "${ECHO_T}$ac_ct_STRIP" >&6
  11470.  else
  11471. -  echo "$ac_t""no" 1>&6
  11472. +  echo "$as_me:$LINENO: result: no" >&5
  11473. +echo "${ECHO_T}no" >&6
  11474.  fi
  11475.  
  11476. +  STRIP=$ac_ct_STRIP
  11477.  else
  11478. -  STRIP=":"
  11479. -fi
  11480. +  STRIP="$ac_cv_prog_STRIP"
  11481.  fi
  11482.  
  11483.  
  11484. @@ -2103,9 +3716,8 @@
  11485.  # Check whether --enable-libtool-lock or --disable-libtool-lock was given.
  11486.  if test "${enable_libtool_lock+set}" = set; then
  11487.    enableval="$enable_libtool_lock"
  11488. -  :
  11489. -fi
  11490.  
  11491. +fi;
  11492.  test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
  11493.  test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
  11494.  
  11495. @@ -2115,8 +3727,7 @@
  11496.    pic_mode="$withval"
  11497.  else
  11498.    pic_mode=default
  11499. -fi
  11500. -
  11501. +fi;
  11502.  test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
  11503.  test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
  11504.  
  11505. @@ -2125,8 +3736,12 @@
  11506.  case $host in
  11507.  *-*-irix6*)
  11508.    # Find out which ABI we are using.
  11509. -  echo '#line 2129 "configure"' > conftest.$ac_ext
  11510. -  if { (eval echo configure:2130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  11511. +  echo '#line 3739 "configure"' > conftest.$ac_ext
  11512. +  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  11513. +  (eval $ac_compile) 2>&5
  11514. +  ac_status=$?
  11515. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  11516. +  (exit $ac_status); }; then
  11517.     if test "$lt_cv_prog_gnu_ld" = yes; then
  11518.      case `/usr/bin/file conftest.$ac_objext` in
  11519.      *32-bit*)
  11520. @@ -2159,7 +3774,11 @@
  11521.  ia64-*-hpux*)
  11522.    # Find out which ABI we are using.
  11523.    echo 'int i;' > conftest.$ac_ext
  11524. -  if { (eval echo configure:2163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  11525. +  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  11526. +  (eval $ac_compile) 2>&5
  11527. +  ac_status=$?
  11528. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  11529. +  (exit $ac_status); }; then
  11530.      case "`/usr/bin/file conftest.o`" in
  11531.      *ELF-32*)
  11532.        HPUX_IA64_MODE="32"
  11533. @@ -2176,47 +3795,64 @@
  11534.    # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  11535.    SAVE_CFLAGS="$CFLAGS"
  11536.    CFLAGS="$CFLAGS -belf"
  11537. -  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
  11538. -echo "configure:2181: checking whether the C compiler needs -belf" >&5
  11539. -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
  11540. -  echo $ac_n "(cached) $ac_c" 1>&6
  11541. +  echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
  11542. +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
  11543. +if test "${lt_cv_cc_needs_belf+set}" = set; then
  11544. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11545.  else
  11546.    
  11547. +
  11548.       ac_ext=c
  11549. -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  11550.  ac_cpp='$CPP $CPPFLAGS'
  11551. -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  11552. -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  11553. -cross_compiling=$ac_cv_prog_cc_cross
  11554. -
  11555. -     cat > conftest.$ac_ext <<EOF
  11556. -#line 2194 "configure"
  11557. -#include "confdefs.h"
  11558. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  11559. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  11560. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  11561. +
  11562. +     cat >conftest.$ac_ext <<_ACEOF
  11563. +#line $LINENO "configure"
  11564. +/* confdefs.h.  */
  11565. +_ACEOF
  11566. +cat confdefs.h >>conftest.$ac_ext
  11567. +cat >>conftest.$ac_ext <<_ACEOF
  11568. +/* end confdefs.h.  */
  11569.  
  11570. -int main() {
  11571. +int
  11572. +main ()
  11573. +{
  11574.  
  11575. -; return 0; }
  11576. -EOF
  11577. -if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  11578. -  rm -rf conftest*
  11579. +  ;
  11580. +  return 0;
  11581. +}
  11582. +_ACEOF
  11583. +rm -f conftest.$ac_objext conftest$ac_exeext
  11584. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  11585. +  (eval $ac_link) 2>&5
  11586. +  ac_status=$?
  11587. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  11588. +  (exit $ac_status); } &&
  11589. +         { ac_try='test -s conftest$ac_exeext'
  11590. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  11591. +  (eval $ac_try) 2>&5
  11592. +  ac_status=$?
  11593. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  11594. +  (exit $ac_status); }; }; then
  11595.    lt_cv_cc_needs_belf=yes
  11596.  else
  11597. -  echo "configure: failed program was:" >&5
  11598. -  cat conftest.$ac_ext >&5
  11599. -  rm -rf conftest*
  11600. -  lt_cv_cc_needs_belf=no
  11601. +  echo "$as_me: failed program was:" >&5
  11602. +sed 's/^/| /' conftest.$ac_ext >&5
  11603. +
  11604. +lt_cv_cc_needs_belf=no
  11605.  fi
  11606. -rm -f conftest*
  11607. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  11608.       ac_ext=c
  11609. -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  11610.  ac_cpp='$CPP $CPPFLAGS'
  11611. -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  11612. -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  11613. -cross_compiling=$ac_cv_prog_cc_cross
  11614. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  11615. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  11616. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  11617.  
  11618.  fi
  11619. -
  11620. -echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
  11621. +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
  11622. +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
  11623.    if test x"$lt_cv_cc_needs_belf" != x"yes"; then
  11624.      # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
  11625.      CFLAGS="$SAVE_CFLAGS"
  11626. @@ -2228,47 +3864,55 @@
  11627.  
  11628.  
  11629.  # Save cache, so that ltconfig can load it
  11630. -cat > confcache <<\EOF
  11631. +cat >confcache <<\_ACEOF
  11632.  # This file is a shell script that caches the results of configure
  11633.  # tests run on this system so they can be shared between configure
  11634. -# scripts and configure runs.  It is not useful on other systems.
  11635. -# If it contains results you don't want to keep, you may remove or edit it.
  11636. +# scripts and configure runs, see configure's option --config-cache.
  11637. +# It is not useful on other systems.  If it contains results you don't
  11638. +# want to keep, you may remove or edit it.
  11639.  #
  11640. -# By default, configure uses ./config.cache as the cache file,
  11641. -# creating it if it does not exist already.  You can give configure
  11642. -# the --cache-file=FILE option to use a different cache file; that is
  11643. -# what configure does when it calls configure scripts in
  11644. -# subdirectories, so they share the cache.
  11645. -# Giving --cache-file=/dev/null disables caching, for debugging configure.
  11646. -# config.status only pays attention to the cache file if you give it the
  11647. -# --recheck option to rerun configure.
  11648. +# config.status only pays attention to the cache file if you give it
  11649. +# the --recheck option to rerun configure.
  11650.  #
  11651. -EOF
  11652. +# `ac_cv_env_foo' variables (set or unset) will be overridden when
  11653. +# loading this file, other *unset* `ac_cv_foo' will be assigned the
  11654. +# following values.
  11655. +
  11656. +_ACEOF
  11657. +
  11658.  # The following way of writing the cache mishandles newlines in values,
  11659.  # but we know of no workaround that is simple, portable, and efficient.
  11660.  # So, don't put newlines in cache variables' values.
  11661.  # Ultrix sh set writes to stderr and can't be redirected directly,
  11662.  # and sets the high bit in the cache file unless we assign to the vars.
  11663. -(set) 2>&1 |
  11664. +{
  11665. +  (set) 2>&1 |
  11666.    case `(ac_space=' '; set | grep ac_space) 2>&1` in
  11667.    *ac_space=\ *)
  11668. -    # `set' does not quote correctly, so add quotes (double-quote substitution
  11669. -    # turns \\\\ into \\, and sed turns \\ into \).
  11670. +      # `set' does not quote correctly, so add quotes (double-quote
  11671. +      # substitution turns \\\\ into \\, and sed turns \\ into \).
  11672.      sed -n \
  11673. -      -e "s/'/'\\\\''/g" \
  11674. -      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
  11675. +        "s/'/'\\\\''/g;
  11676. +          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
  11677.      ;;
  11678.    *)
  11679.      # `set' quotes correctly as required by POSIX, so do not add quotes.
  11680. -    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
  11681. -    ;;
  11682. -  esac >> confcache
  11683. -if cmp -s $cache_file confcache; then
  11684. -  :
  11685. -else
  11686. +      sed -n \
  11687. +        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
  11688. +    ;;
  11689. +    esac;
  11690. +} |
  11691. +  sed '
  11692. +     t clear
  11693. +     : clear
  11694. +     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
  11695. +     t end
  11696. +     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
  11697. +     : end' >>confcache
  11698. +if diff $cache_file confcache >/dev/null 2>&1; then :; else
  11699.    if test -w $cache_file; then
  11700. -    echo "updating cache $cache_file"
  11701. -    cat confcache > $cache_file
  11702. +    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
  11703. +    cat confcache >$cache_file
  11704.    else
  11705.      echo "not updating unwritable cache $cache_file"
  11706.    fi
  11707. @@ -2285,15 +3929,26 @@
  11708.  deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
  11709.  ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
  11710.  $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
  11711. -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
  11712. +|| { { echo "$as_me:$LINENO: error: libtool configure failed" >&5
  11713. +echo "$as_me: error: libtool configure failed" >&2;}
  11714. +   { (exit 1); exit 1; }; }
  11715.  
  11716.  # Reload cache, that may have been modified by ltconfig
  11717.  if test -r "$cache_file"; then
  11718. -  echo "loading cache $cache_file"
  11719. -  . $cache_file
  11720. +  # Some versions of bash will fail to source /dev/null (special
  11721. +  # files actually), so we avoid doing that.
  11722. +  if test -f "$cache_file"; then
  11723. +    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
  11724. +echo "$as_me: loading cache $cache_file" >&6;}
  11725. +    case $cache_file in
  11726. +      [\\/]* | ?:[\\/]* ) . $cache_file;;
  11727. +      *)                      . ./$cache_file;;
  11728. +    esac
  11729. +  fi
  11730.  else
  11731. -  echo "creating cache $cache_file"
  11732. -  > $cache_file
  11733. +  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
  11734. +echo "$as_me: creating cache $cache_file" >&6;}
  11735. +  >$cache_file
  11736.  fi
  11737.  
  11738.  
  11739. @@ -2319,42 +3974,47 @@
  11740.    case "${enableval}" in
  11741.    yes)  want64=true  ;;
  11742.    no)   want64=false ;;
  11743. -  *)    { echo "configure: error: bad value ${enableval} for 64-bit-bfd option" 1>&2; exit 1; } ;;
  11744. +  *)    { { echo "$as_me:$LINENO: error: bad value ${enableval} for 64-bit-bfd option" >&5
  11745. +echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;}
  11746. +   { (exit 1); exit 1; }; } ;;
  11747.  esac
  11748.  else
  11749.    want64=false
  11750. -fi
  11751. -# Check whether --enable-targets or --disable-targets was given.
  11752. +fi; # Check whether --enable-targets or --disable-targets was given.
  11753.  if test "${enable_targets+set}" = set; then
  11754.    enableval="$enable_targets"
  11755.    case "${enableval}" in
  11756. -  yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; }
  11757. +  yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5
  11758. +echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;}
  11759. +   { (exit 1); exit 1; }; }
  11760.              ;;
  11761.    no)       enable_targets= ;;
  11762.    *)        enable_targets=$enableval ;;
  11763.  esac
  11764. -fi
  11765. -# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given.
  11766. +fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given.
  11767.  if test "${enable_commonbfdlib+set}" = set; then
  11768.    enableval="$enable_commonbfdlib"
  11769.    case "${enableval}" in
  11770.    yes) commonbfdlib=true ;;
  11771.    no)  commonbfdlib=false ;;
  11772. -  *)   { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;;
  11773. +  *)   { { echo "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5
  11774. +echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;}
  11775. +   { (exit 1); exit 1; }; } ;;
  11776.  esac
  11777. -fi
  11778. +fi;
  11779.  # Check whether --with-mmap or --without-mmap was given.
  11780.  if test "${with_mmap+set}" = set; then
  11781.    withval="$with_mmap"
  11782.    case "${withval}" in
  11783.    yes)  want_mmap=true ;;
  11784.    no)   want_mmap=false ;;
  11785. -  *)    { echo "configure: error: bad value ${withval} for BFD with-mmap option" 1>&2; exit 1; } ;;
  11786. +  *)    { { echo "$as_me:$LINENO: error: bad value ${withval} for BFD with-mmap option" >&5
  11787. +echo "$as_me: error: bad value ${withval} for BFD with-mmap option" >&2;}
  11788. +   { (exit 1); exit 1; }; } ;;
  11789.  esac
  11790.  else
  11791.    want_mmap=false
  11792. -fi
  11793. -
  11794. +fi;
  11795.  build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
  11796.  # Check whether --enable-build-warnings or --disable-build-warnings was given.
  11797.  if test "${enable_build_warnings+set}" = set; then
  11798. @@ -2371,32 +4031,36 @@
  11799.  if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
  11800.    echo "Setting warning flags = $build_warnings" 6>&1
  11801.  fi
  11802. -fi
  11803. -WARN_CFLAGS=""
  11804. +fi; WARN_CFLAGS=""
  11805.  if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then
  11806.      WARN_CFLAGS="${build_warnings}"
  11807.  fi
  11808.  
  11809.  
  11810. +# Add the stamp file to the list of files AC keeps track of,
  11811. +# along with our hook.
  11812. +          ac_config_headers="$ac_config_headers config.h:config.in"
  11813.  
  11814.  
  11815.  
  11816.  
  11817.  if test -z "$target" ; then
  11818. -    { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; }
  11819. +    { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5
  11820. +echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;}
  11821. +   { (exit 1); exit 1; }; }
  11822.  fi
  11823.  
  11824. -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
  11825. -echo "configure:2391: checking whether to enable maintainer-specific portions of Makefiles" >&5
  11826. +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
  11827. +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
  11828.      # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
  11829.  if test "${enable_maintainer_mode+set}" = set; then
  11830.    enableval="$enable_maintainer_mode"
  11831.    USE_MAINTAINER_MODE=$enableval
  11832.  else
  11833.    USE_MAINTAINER_MODE=no
  11834. -fi
  11835. -
  11836. -  echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
  11837. +fi;
  11838. +  echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
  11839. +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
  11840.    
  11841.  
  11842.  if test $USE_MAINTAINER_MODE = yes; then
  11843. @@ -2409,8 +4073,8 @@
  11844.    MAINT=$MAINTAINER_MODE_TRUE
  11845.    
  11846.  
  11847. -echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6
  11848. -echo "configure:2414: checking whether to install libbfd" >&5
  11849. +echo "$as_me:$LINENO: checking whether to install libbfd" >&5
  11850. +echo $ECHO_N "checking whether to install libbfd... $ECHO_C" >&6
  11851.    # Check whether --enable-install-libbfd or --disable-install-libbfd was given.
  11852.  if test "${enable_install_libbfd+set}" = set; then
  11853.    enableval="$enable_install_libbfd"
  11854. @@ -2421,9 +4085,9 @@
  11855.        else
  11856.          install_libbfd_p=no
  11857.        fi
  11858. -fi
  11859. -
  11860. -  echo "$ac_t""$install_libbfd_p" 1>&6
  11861. +fi;
  11862. +  echo "$as_me:$LINENO: result: $install_libbfd_p" >&5
  11863. +echo "${ECHO_T}$install_libbfd_p" >&6
  11864.    
  11865.  
  11866.  if test $install_libbfd_p = yes; then
  11867. @@ -2446,252 +4110,446 @@
  11868.  
  11869.  
  11870.  
  11871. -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
  11872. -echo "configure:2451: checking for executable suffix" >&5
  11873. -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
  11874. -  echo $ac_n "(cached) $ac_c" 1>&6
  11875. +host64=false
  11876. +target64=false
  11877. +bfd_default_target_size=32
  11878. +
  11879. +# host stuff:
  11880. +
  11881. +ac_ext=c
  11882. +ac_cpp='$CPP $CPPFLAGS'
  11883. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  11884. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  11885. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  11886. +if test -n "$ac_tool_prefix"; then
  11887. +  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
  11888. +set dummy ${ac_tool_prefix}gcc; ac_word=$2
  11889. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  11890. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  11891. +if test "${ac_cv_prog_CC+set}" = set; then
  11892. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11893.  else
  11894. -  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
  11895. -  ac_cv_exeext=.exe
  11896. +  if test -n "$CC"; then
  11897. +  ac_cv_prog_CC="$CC" # Let the user override the test.
  11898.  else
  11899. -  rm -f conftest*
  11900. -  echo 'int main () { return 0; }' > conftest.$ac_ext
  11901. -  ac_cv_exeext=
  11902. -  if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
  11903. -    for file in conftest.*; do
  11904. -      case $file in
  11905. -      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
  11906. -      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
  11907. -      esac
  11908. -    done
  11909. -  else
  11910. -    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
  11911. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  11912. +for as_dir in $PATH
  11913. +do
  11914. +  IFS=$as_save_IFS
  11915. +  test -z "$as_dir" && as_dir=.
  11916. +  for ac_exec_ext in '' $ac_executable_extensions; do
  11917. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  11918. +    ac_cv_prog_CC="${ac_tool_prefix}gcc"
  11919. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  11920. +    break 2
  11921.    fi
  11922. -  rm -f conftest*
  11923. -  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
  11924. +done
  11925. +done
  11926. +
  11927.  fi
  11928.  fi
  11929. +CC=$ac_cv_prog_CC
  11930. +if test -n "$CC"; then
  11931. +  echo "$as_me:$LINENO: result: $CC" >&5
  11932. +echo "${ECHO_T}$CC" >&6
  11933. +else
  11934. +  echo "$as_me:$LINENO: result: no" >&5
  11935. +echo "${ECHO_T}no" >&6
  11936. +fi
  11937.  
  11938. -EXEEXT=""
  11939. -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
  11940. -echo "$ac_t""${ac_cv_exeext}" 1>&6
  11941. -ac_exeext=$EXEEXT
  11942. -
  11943. +fi
  11944. +if test -z "$ac_cv_prog_CC"; then
  11945. +  ac_ct_CC=$CC
  11946. +  # Extract the first word of "gcc", so it can be a program name with args.
  11947. +set dummy gcc; ac_word=$2
  11948. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  11949. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  11950. +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  11951. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  11952. +else
  11953. +  if test -n "$ac_ct_CC"; then
  11954. +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  11955. +else
  11956. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  11957. +for as_dir in $PATH
  11958. +do
  11959. +  IFS=$as_save_IFS
  11960. +  test -z "$as_dir" && as_dir=.
  11961. +  for ac_exec_ext in '' $ac_executable_extensions; do
  11962. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  11963. +    ac_cv_prog_ac_ct_CC="gcc"
  11964. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  11965. +    break 2
  11966. +  fi
  11967. +done
  11968. +done
  11969.  
  11970. -host64=false
  11971. -target64=false
  11972. -bfd_default_target_size=32
  11973. +fi
  11974. +fi
  11975. +ac_ct_CC=$ac_cv_prog_ac_ct_CC
  11976. +if test -n "$ac_ct_CC"; then
  11977. +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
  11978. +echo "${ECHO_T}$ac_ct_CC" >&6
  11979. +else
  11980. +  echo "$as_me:$LINENO: result: no" >&5
  11981. +echo "${ECHO_T}no" >&6
  11982. +fi
  11983.  
  11984. -# host stuff:
  11985. +  CC=$ac_ct_CC
  11986. +else
  11987. +  CC="$ac_cv_prog_CC"
  11988. +fi
  11989.  
  11990. -# Extract the first word of "gcc", so it can be a program name with args.
  11991. -set dummy gcc; ac_word=$2
  11992. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  11993. -echo "configure:2491: checking for $ac_word" >&5
  11994. -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  11995. -  echo $ac_n "(cached) $ac_c" 1>&6
  11996. +if test -z "$CC"; then
  11997. +  if test -n "$ac_tool_prefix"; then
  11998. +  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
  11999. +set dummy ${ac_tool_prefix}cc; ac_word=$2
  12000. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  12001. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  12002. +if test "${ac_cv_prog_CC+set}" = set; then
  12003. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12004.  else
  12005.    if test -n "$CC"; then
  12006.    ac_cv_prog_CC="$CC" # Let the user override the test.
  12007.  else
  12008. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  12009. -  ac_dummy="$PATH"
  12010. -  for ac_dir in $ac_dummy; do
  12011. -    test -z "$ac_dir" && ac_dir=.
  12012. -    if test -f $ac_dir/$ac_word; then
  12013. -      ac_cv_prog_CC="gcc"
  12014. -      break
  12015. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  12016. +for as_dir in $PATH
  12017. +do
  12018. +  IFS=$as_save_IFS
  12019. +  test -z "$as_dir" && as_dir=.
  12020. +  for ac_exec_ext in '' $ac_executable_extensions; do
  12021. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  12022. +    ac_cv_prog_CC="${ac_tool_prefix}cc"
  12023. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  12024. +    break 2
  12025.      fi
  12026. -  done
  12027. -  IFS="$ac_save_ifs"
  12028. +done
  12029. +done
  12030. +
  12031.  fi
  12032.  fi
  12033. -CC="$ac_cv_prog_CC"
  12034. +CC=$ac_cv_prog_CC
  12035.  if test -n "$CC"; then
  12036. -  echo "$ac_t""$CC" 1>&6
  12037. +  echo "$as_me:$LINENO: result: $CC" >&5
  12038. +echo "${ECHO_T}$CC" >&6
  12039. +else
  12040. +  echo "$as_me:$LINENO: result: no" >&5
  12041. +echo "${ECHO_T}no" >&6
  12042. +fi
  12043. +
  12044. +fi
  12045. +if test -z "$ac_cv_prog_CC"; then
  12046. +  ac_ct_CC=$CC
  12047. +  # Extract the first word of "cc", so it can be a program name with args.
  12048. +set dummy cc; ac_word=$2
  12049. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  12050. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  12051. +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  12052. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12053. +else
  12054. +  if test -n "$ac_ct_CC"; then
  12055. +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  12056. +else
  12057. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  12058. +for as_dir in $PATH
  12059. +do
  12060. +  IFS=$as_save_IFS
  12061. +  test -z "$as_dir" && as_dir=.
  12062. +  for ac_exec_ext in '' $ac_executable_extensions; do
  12063. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  12064. +    ac_cv_prog_ac_ct_CC="cc"
  12065. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  12066. +    break 2
  12067. +  fi
  12068. +done
  12069. +done
  12070. +
  12071. +fi
  12072. +fi
  12073. +ac_ct_CC=$ac_cv_prog_ac_ct_CC
  12074. +if test -n "$ac_ct_CC"; then
  12075. +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
  12076. +echo "${ECHO_T}$ac_ct_CC" >&6
  12077.  else
  12078. -  echo "$ac_t""no" 1>&6
  12079. +  echo "$as_me:$LINENO: result: no" >&5
  12080. +echo "${ECHO_T}no" >&6
  12081.  fi
  12082.  
  12083. +  CC=$ac_ct_CC
  12084. +else
  12085. +  CC="$ac_cv_prog_CC"
  12086. +fi
  12087. +
  12088. +fi
  12089.  if test -z "$CC"; then
  12090.    # Extract the first word of "cc", so it can be a program name with args.
  12091.  set dummy cc; ac_word=$2
  12092. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  12093. -echo "configure:2521: checking for $ac_word" >&5
  12094. -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  12095. -  echo $ac_n "(cached) $ac_c" 1>&6
  12096. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  12097. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  12098. +if test "${ac_cv_prog_CC+set}" = set; then
  12099. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12100.  else
  12101.    if test -n "$CC"; then
  12102.    ac_cv_prog_CC="$CC" # Let the user override the test.
  12103.  else
  12104. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  12105.    ac_prog_rejected=no
  12106. -  ac_dummy="$PATH"
  12107. -  for ac_dir in $ac_dummy; do
  12108. -    test -z "$ac_dir" && ac_dir=.
  12109. -    if test -f $ac_dir/$ac_word; then
  12110. -      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
  12111. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  12112. +for as_dir in $PATH
  12113. +do
  12114. +  IFS=$as_save_IFS
  12115. +  test -z "$as_dir" && as_dir=.
  12116. +  for ac_exec_ext in '' $ac_executable_extensions; do
  12117. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  12118. +    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
  12119.          ac_prog_rejected=yes
  12120.      continue
  12121.        fi
  12122.        ac_cv_prog_CC="cc"
  12123. -      break
  12124. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  12125. +    break 2
  12126.      fi
  12127. -  done
  12128. -  IFS="$ac_save_ifs"
  12129. +done
  12130. +done
  12131. +
  12132.  if test $ac_prog_rejected = yes; then
  12133.    # We found a bogon in the path, so make sure we never use it.
  12134.    set dummy $ac_cv_prog_CC
  12135.    shift
  12136. -  if test $# -gt 0; then
  12137. +  if test $# != 0; then
  12138.      # We chose a different compiler from the bogus one.
  12139.      # However, it has the same basename, so the bogon will be chosen
  12140.      # first if we set CC to just the basename; use the full file name.
  12141.      shift
  12142. -    set dummy "$ac_dir/$ac_word" "$@"
  12143. -    shift
  12144. -    ac_cv_prog_CC="$@"
  12145. +    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
  12146.    fi
  12147.  fi
  12148.  fi
  12149.  fi
  12150. -CC="$ac_cv_prog_CC"
  12151. +CC=$ac_cv_prog_CC
  12152.  if test -n "$CC"; then
  12153. -  echo "$ac_t""$CC" 1>&6
  12154. +  echo "$as_me:$LINENO: result: $CC" >&5
  12155. +echo "${ECHO_T}$CC" >&6
  12156.  else
  12157. -  echo "$ac_t""no" 1>&6
  12158. +  echo "$as_me:$LINENO: result: no" >&5
  12159. +echo "${ECHO_T}no" >&6
  12160.  fi
  12161.  
  12162. -  if test -z "$CC"; then
  12163. -    case "`uname -s`" in
  12164. -    *win32* | *WIN32*)
  12165. -      # Extract the first word of "cl", so it can be a program name with args.
  12166. -set dummy cl; ac_word=$2
  12167. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  12168. -echo "configure:2572: checking for $ac_word" >&5
  12169. -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  12170. -  echo $ac_n "(cached) $ac_c" 1>&6
  12171. +fi
  12172. +if test -z "$CC"; then
  12173. +  if test -n "$ac_tool_prefix"; then
  12174. +  for ac_prog in cl
  12175. +  do
  12176. +    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
  12177. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2
  12178. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  12179. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  12180. +if test "${ac_cv_prog_CC+set}" = set; then
  12181. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12182.  else
  12183.    if test -n "$CC"; then
  12184.    ac_cv_prog_CC="$CC" # Let the user override the test.
  12185.  else
  12186. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  12187. -  ac_dummy="$PATH"
  12188. -  for ac_dir in $ac_dummy; do
  12189. -    test -z "$ac_dir" && ac_dir=.
  12190. -    if test -f $ac_dir/$ac_word; then
  12191. -      ac_cv_prog_CC="cl"
  12192. -      break
  12193. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  12194. +for as_dir in $PATH
  12195. +do
  12196. +  IFS=$as_save_IFS
  12197. +  test -z "$as_dir" && as_dir=.
  12198. +  for ac_exec_ext in '' $ac_executable_extensions; do
  12199. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  12200. +    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
  12201. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  12202. +    break 2
  12203.      fi
  12204. -  done
  12205. -  IFS="$ac_save_ifs"
  12206. +done
  12207. +done
  12208. +
  12209.  fi
  12210.  fi
  12211. -CC="$ac_cv_prog_CC"
  12212. +CC=$ac_cv_prog_CC
  12213.  if test -n "$CC"; then
  12214. -  echo "$ac_t""$CC" 1>&6
  12215. +  echo "$as_me:$LINENO: result: $CC" >&5
  12216. +echo "${ECHO_T}$CC" >&6
  12217.  else
  12218. -  echo "$ac_t""no" 1>&6
  12219. +  echo "$as_me:$LINENO: result: no" >&5
  12220. +echo "${ECHO_T}no" >&6
  12221.  fi
  12222. - ;;
  12223. -    esac
  12224. +
  12225. +    test -n "$CC" && break
  12226. +  done
  12227. +fi
  12228. +if test -z "$CC"; then
  12229. +  ac_ct_CC=$CC
  12230. +  for ac_prog in cl
  12231. +do
  12232. +  # Extract the first word of "$ac_prog", so it can be a program name with args.
  12233. +set dummy $ac_prog; ac_word=$2
  12234. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  12235. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  12236. +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  12237. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12238. +else
  12239. +  if test -n "$ac_ct_CC"; then
  12240. +  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
  12241. +else
  12242. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  12243. +for as_dir in $PATH
  12244. +do
  12245. +  IFS=$as_save_IFS
  12246. +  test -z "$as_dir" && as_dir=.
  12247. +  for ac_exec_ext in '' $ac_executable_extensions; do
  12248. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  12249. +    ac_cv_prog_ac_ct_CC="$ac_prog"
  12250. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  12251. +    break 2
  12252.    fi
  12253. -  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
  12254. +done
  12255. +done
  12256. +
  12257. +fi
  12258. +fi
  12259. +ac_ct_CC=$ac_cv_prog_ac_ct_CC
  12260. +if test -n "$ac_ct_CC"; then
  12261. +  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
  12262. +echo "${ECHO_T}$ac_ct_CC" >&6
  12263. +else
  12264. +  echo "$as_me:$LINENO: result: no" >&5
  12265. +echo "${ECHO_T}no" >&6
  12266.  fi
  12267.  
  12268. -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
  12269. -echo "configure:2604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
  12270. +  test -n "$ac_ct_CC" && break
  12271. +done
  12272.  
  12273. -ac_ext=c
  12274. -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  12275. -ac_cpp='$CPP $CPPFLAGS'
  12276. -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  12277. -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  12278. -cross_compiling=$ac_cv_prog_cc_cross
  12279. +  CC=$ac_ct_CC
  12280. +fi
  12281.  
  12282. -cat > conftest.$ac_ext << EOF
  12283. +fi
  12284.  
  12285. -#line 2615 "configure"
  12286. -#include "confdefs.h"
  12287.  
  12288. -main(){return(0);}
  12289. -EOF
  12290. -if { (eval echo configure:2620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  12291. -  ac_cv_prog_cc_works=yes
  12292. -  # If we can't run a trivial program, we are probably using a cross compiler.
  12293. -  if (./conftest; exit) 2>/dev/null; then
  12294. -    ac_cv_prog_cc_cross=no
  12295. -  else
  12296. -    ac_cv_prog_cc_cross=yes
  12297. -  fi
  12298. -else
  12299. -  echo "configure: failed program was:" >&5
  12300. -  cat conftest.$ac_ext >&5
  12301. -  ac_cv_prog_cc_works=no
  12302. -fi
  12303. -rm -fr conftest*
  12304. -ac_ext=c
  12305. -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  12306. -ac_cpp='$CPP $CPPFLAGS'
  12307. -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
  12308. -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  12309. -cross_compiling=$ac_cv_prog_cc_cross
  12310. -
  12311. -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
  12312. -if test $ac_cv_prog_cc_works = no; then
  12313. -  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
  12314. -fi
  12315. -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
  12316. -echo "configure:2646: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
  12317. -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
  12318. -cross_compiling=$ac_cv_prog_cc_cross
  12319. -
  12320. -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
  12321. -echo "configure:2651: checking whether we are using GNU C" >&5
  12322. -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
  12323. -  echo $ac_n "(cached) $ac_c" 1>&6
  12324. -else
  12325. -  cat > conftest.c <<EOF
  12326. -#ifdef __GNUC__
  12327. -  yes;
  12328. +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
  12329. +See \`config.log' for more details." >&5
  12330. +echo "$as_me: error: no acceptable C compiler found in \$PATH
  12331. +See \`config.log' for more details." >&2;}
  12332. +   { (exit 1); exit 1; }; }
  12333. +
  12334. +# Provide some information about the compiler.
  12335. +echo "$as_me:$LINENO:" \
  12336. +     "checking for C compiler version" >&5
  12337. +ac_compiler=`set X $ac_compile; echo $2`
  12338. +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
  12339. +  (eval $ac_compiler --version </dev/null >&5) 2>&5
  12340. +  ac_status=$?
  12341. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12342. +  (exit $ac_status); }
  12343. +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
  12344. +  (eval $ac_compiler -v </dev/null >&5) 2>&5
  12345. +  ac_status=$?
  12346. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12347. +  (exit $ac_status); }
  12348. +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
  12349. +  (eval $ac_compiler -V </dev/null >&5) 2>&5
  12350. +  ac_status=$?
  12351. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12352. +  (exit $ac_status); }
  12353. +
  12354. +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
  12355. +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
  12356. +if test "${ac_cv_c_compiler_gnu+set}" = set; then
  12357. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12358. +else
  12359. +  cat >conftest.$ac_ext <<_ACEOF
  12360. +#line $LINENO "configure"
  12361. +/* confdefs.h.  */
  12362. +_ACEOF
  12363. +cat confdefs.h >>conftest.$ac_ext
  12364. +cat >>conftest.$ac_ext <<_ACEOF
  12365. +/* end confdefs.h.  */
  12366. +
  12367. +int
  12368. +main ()
  12369. +{
  12370. +#ifndef __GNUC__
  12371. +       choke me
  12372.  #endif
  12373. -EOF
  12374. -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
  12375. -  ac_cv_prog_gcc=yes
  12376. -else
  12377. -  ac_cv_prog_gcc=no
  12378. -fi
  12379. -fi
  12380.  
  12381. -echo "$ac_t""$ac_cv_prog_gcc" 1>&6
  12382. +  ;
  12383. +  return 0;
  12384. +}
  12385. +_ACEOF
  12386. +rm -f conftest.$ac_objext
  12387. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  12388. +  (eval $ac_compile) 2>&5
  12389. +  ac_status=$?
  12390. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12391. +  (exit $ac_status); } &&
  12392. +         { ac_try='test -s conftest.$ac_objext'
  12393. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  12394. +  (eval $ac_try) 2>&5
  12395. +  ac_status=$?
  12396. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12397. +  (exit $ac_status); }; }; then
  12398. +  ac_compiler_gnu=yes
  12399. +else
  12400. +  echo "$as_me: failed program was:" >&5
  12401. +sed 's/^/| /' conftest.$ac_ext >&5
  12402. +
  12403. +ac_compiler_gnu=no
  12404. +fi
  12405. +rm -f conftest.$ac_objext conftest.$ac_ext
  12406. +ac_cv_c_compiler_gnu=$ac_compiler_gnu
  12407. +
  12408. +fi
  12409. +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
  12410. +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
  12411. +GCC=`test $ac_compiler_gnu = yes && echo yes`
  12412. +ac_test_CFLAGS=${CFLAGS+set}
  12413. +ac_save_CFLAGS=$CFLAGS
  12414. +CFLAGS="-g"
  12415. +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
  12416. +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
  12417. +if test "${ac_cv_prog_cc_g+set}" = set; then
  12418. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12419. +else
  12420. +  cat >conftest.$ac_ext <<_ACEOF
  12421. +#line $LINENO "configure"
  12422. +/* confdefs.h.  */
  12423. +_ACEOF
  12424. +cat confdefs.h >>conftest.$ac_ext
  12425. +cat >>conftest.$ac_ext <<_ACEOF
  12426. +/* end confdefs.h.  */
  12427.  
  12428. -if test $ac_cv_prog_gcc = yes; then
  12429. -  GCC=yes
  12430. -else
  12431. -  GCC=
  12432. -fi
  12433. +int
  12434. +main ()
  12435. +{
  12436.  
  12437. -ac_test_CFLAGS="${CFLAGS+set}"
  12438. -ac_save_CFLAGS="$CFLAGS"
  12439. -CFLAGS=
  12440. -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
  12441. -echo "configure:2679: checking whether ${CC-cc} accepts -g" >&5
  12442. -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
  12443. -  echo $ac_n "(cached) $ac_c" 1>&6
  12444. -else
  12445. -  echo 'void f(){}' > conftest.c
  12446. -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
  12447. +  ;
  12448. +  return 0;
  12449. +}
  12450. +_ACEOF
  12451. +rm -f conftest.$ac_objext
  12452. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  12453. +  (eval $ac_compile) 2>&5
  12454. +  ac_status=$?
  12455. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12456. +  (exit $ac_status); } &&
  12457. +         { ac_try='test -s conftest.$ac_objext'
  12458. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  12459. +  (eval $ac_try) 2>&5
  12460. +  ac_status=$?
  12461. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12462. +  (exit $ac_status); }; }; then
  12463.    ac_cv_prog_cc_g=yes
  12464.  else
  12465. -  ac_cv_prog_cc_g=no
  12466. -fi
  12467. -rm -f conftest*
  12468. +  echo "$as_me: failed program was:" >&5
  12469. +sed 's/^/| /' conftest.$ac_ext >&5
  12470.  
  12471. +ac_cv_prog_cc_g=no
  12472.  fi
  12473. -
  12474. -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
  12475. +rm -f conftest.$ac_objext conftest.$ac_ext
  12476. +fi
  12477. +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
  12478. +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
  12479.  if test "$ac_test_CFLAGS" = set; then
  12480. -  CFLAGS="$ac_save_CFLAGS"
  12481. +  CFLAGS=$ac_save_CFLAGS
  12482.  elif test $ac_cv_prog_cc_g = yes; then
  12483.    if test "$GCC" = yes; then
  12484.      CFLAGS="-g -O2"
  12485. @@ -2705,159 +4563,618 @@
  12486.      CFLAGS=
  12487.    fi
  12488.  fi
  12489. +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
  12490. +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
  12491. +if test "${ac_cv_prog_cc_stdc+set}" = set; then
  12492. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12493. +else
  12494. +  ac_cv_prog_cc_stdc=no
  12495. +ac_save_CC=$CC
  12496. +cat >conftest.$ac_ext <<_ACEOF
  12497. +#line $LINENO "configure"
  12498. +/* confdefs.h.  */
  12499. +_ACEOF
  12500. +cat confdefs.h >>conftest.$ac_ext
  12501. +cat >>conftest.$ac_ext <<_ACEOF
  12502. +/* end confdefs.h.  */
  12503. +#include <stdarg.h>
  12504. +#include <stdio.h>
  12505. +#include <sys/types.h>
  12506. +#include <sys/stat.h>
  12507. +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
  12508. +struct buf { int x; };
  12509. +FILE * (*rcsopen) (struct buf *, struct stat *, int);
  12510. +static char *e (p, i)
  12511. +     char **p;
  12512. +     int i;
  12513. +{
  12514. +  return p[i];
  12515. +}
  12516. +static char *f (char * (*g) (char **, int), char **p, ...)
  12517. +{
  12518. +  char *s;
  12519. +  va_list v;
  12520. +  va_start (v,p);
  12521. +  s = g (p, va_arg (v,int));
  12522. +  va_end (v);
  12523. +  return s;
  12524. +}
  12525. +int test (int i, double x);
  12526. +struct s1 {int (*f) (int a);};
  12527. +struct s2 {int (*f) (double a);};
  12528. +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
  12529. +int argc;
  12530. +char **argv;
  12531. +int
  12532. +main ()
  12533. +{
  12534. +return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
  12535. +  ;
  12536. +  return 0;
  12537. +}
  12538. +_ACEOF
  12539. +# Don't try gcc -ansi; that turns off useful extensions and
  12540. +# breaks some systems' header files.
  12541. +# AIX            -qlanglvl=ansi
  12542. +# Ultrix and OSF/1    -std1
  12543. +# HP-UX 10.20 and later    -Ae
  12544. +# HP-UX older versions    -Aa -D_HPUX_SOURCE
  12545. +# SVR4            -Xc -D__EXTENSIONS__
  12546. +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
  12547. +do
  12548. +  CC="$ac_save_CC $ac_arg"
  12549. +  rm -f conftest.$ac_objext
  12550. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  12551. +  (eval $ac_compile) 2>&5
  12552. +  ac_status=$?
  12553. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12554. +  (exit $ac_status); } &&
  12555. +         { ac_try='test -s conftest.$ac_objext'
  12556. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  12557. +  (eval $ac_try) 2>&5
  12558. +  ac_status=$?
  12559. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12560. +  (exit $ac_status); }; }; then
  12561. +  ac_cv_prog_cc_stdc=$ac_arg
  12562. +break
  12563. +else
  12564. +  echo "$as_me: failed program was:" >&5
  12565. +sed 's/^/| /' conftest.$ac_ext >&5
  12566. +
  12567. +fi
  12568. +rm -f conftest.$ac_objext
  12569. +done
  12570. +rm -f conftest.$ac_ext conftest.$ac_objext
  12571. +CC=$ac_save_CC
  12572. +
  12573. +fi
  12574. +
  12575. +case "x$ac_cv_prog_cc_stdc" in
  12576. +  x|xno)
  12577. +    echo "$as_me:$LINENO: result: none needed" >&5
  12578. +echo "${ECHO_T}none needed" >&6 ;;
  12579. +  *)
  12580. +    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
  12581. +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
  12582. +    CC="$CC $ac_cv_prog_cc_stdc" ;;
  12583. +esac
  12584. +
  12585. +# Some people use a C++ compiler to compile C.  Since we use `exit',
  12586. +# in C++ we need to declare it.  In case someone uses the same compiler
  12587. +# for both compiling C and C++ we need to have the C++ compiler decide
  12588. +# the declaration of exit, since it's the most demanding environment.
  12589. +cat >conftest.$ac_ext <<_ACEOF
  12590. +#ifndef __cplusplus
  12591. +  choke me
  12592. +#endif
  12593. +_ACEOF
  12594. +rm -f conftest.$ac_objext
  12595. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  12596. +  (eval $ac_compile) 2>&5
  12597. +  ac_status=$?
  12598. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12599. +  (exit $ac_status); } &&
  12600. +         { ac_try='test -s conftest.$ac_objext'
  12601. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  12602. +  (eval $ac_try) 2>&5
  12603. +  ac_status=$?
  12604. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12605. +  (exit $ac_status); }; }; then
  12606. +  for ac_declaration in \
  12607. +   ''\
  12608. +   '#include <stdlib.h>' \
  12609. +   'extern "C" void std::exit (int) throw (); using std::exit;' \
  12610. +   'extern "C" void std::exit (int); using std::exit;' \
  12611. +   'extern "C" void exit (int) throw ();' \
  12612. +   'extern "C" void exit (int);' \
  12613. +   'void exit (int);'
  12614. +do
  12615. +  cat >conftest.$ac_ext <<_ACEOF
  12616. +#line $LINENO "configure"
  12617. +/* confdefs.h.  */
  12618. +_ACEOF
  12619. +cat confdefs.h >>conftest.$ac_ext
  12620. +cat >>conftest.$ac_ext <<_ACEOF
  12621. +/* end confdefs.h.  */
  12622. +#include <stdlib.h>
  12623. +$ac_declaration
  12624. +int
  12625. +main ()
  12626. +{
  12627. +exit (42);
  12628. +  ;
  12629. +  return 0;
  12630. +}
  12631. +_ACEOF
  12632. +rm -f conftest.$ac_objext
  12633. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  12634. +  (eval $ac_compile) 2>&5
  12635. +  ac_status=$?
  12636. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12637. +  (exit $ac_status); } &&
  12638. +         { ac_try='test -s conftest.$ac_objext'
  12639. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  12640. +  (eval $ac_try) 2>&5
  12641. +  ac_status=$?
  12642. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12643. +  (exit $ac_status); }; }; then
  12644. +  :
  12645. +else
  12646. +  echo "$as_me: failed program was:" >&5
  12647. +sed 's/^/| /' conftest.$ac_ext >&5
  12648. +
  12649. +continue
  12650. +fi
  12651. +rm -f conftest.$ac_objext conftest.$ac_ext
  12652. +  cat >conftest.$ac_ext <<_ACEOF
  12653. +#line $LINENO "configure"
  12654. +/* confdefs.h.  */
  12655. +_ACEOF
  12656. +cat confdefs.h >>conftest.$ac_ext
  12657. +cat >>conftest.$ac_ext <<_ACEOF
  12658. +/* end confdefs.h.  */
  12659. +$ac_declaration
  12660. +int
  12661. +main ()
  12662. +{
  12663. +exit (42);
  12664. +  ;
  12665. +  return 0;
  12666. +}
  12667. +_ACEOF
  12668. +rm -f conftest.$ac_objext
  12669. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  12670. +  (eval $ac_compile) 2>&5
  12671. +  ac_status=$?
  12672. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12673. +  (exit $ac_status); } &&
  12674. +         { ac_try='test -s conftest.$ac_objext'
  12675. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  12676. +  (eval $ac_try) 2>&5
  12677. +  ac_status=$?
  12678. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12679. +  (exit $ac_status); }; }; then
  12680. +  break
  12681. +else
  12682. +  echo "$as_me: failed program was:" >&5
  12683. +sed 's/^/| /' conftest.$ac_ext >&5
  12684. +
  12685. +fi
  12686. +rm -f conftest.$ac_objext conftest.$ac_ext
  12687. +done
  12688. +rm -f conftest*
  12689. +if test -n "$ac_declaration"; then
  12690. +  echo '#ifdef __cplusplus' >>confdefs.h
  12691. +  echo $ac_declaration      >>confdefs.h
  12692. +  echo '#endif'             >>confdefs.h
  12693. +fi
  12694. +
  12695. +else
  12696. +  echo "$as_me: failed program was:" >&5
  12697. +sed 's/^/| /' conftest.$ac_ext >&5
  12698. +
  12699. +fi
  12700. +rm -f conftest.$ac_objext conftest.$ac_ext
  12701. +ac_ext=c
  12702. +ac_cpp='$CPP $CPPFLAGS'
  12703. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  12704. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  12705. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  12706. +
  12707. +
  12708. +ALL_LINGUAS="fr tr ja es sv da zh_CN"
  12709. +if test -n "$ac_tool_prefix"; then
  12710. +  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  12711. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2
  12712. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  12713. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  12714. +if test "${ac_cv_prog_RANLIB+set}" = set; then
  12715. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12716. +else
  12717. +  if test -n "$RANLIB"; then
  12718. +  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  12719. +else
  12720. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  12721. +for as_dir in $PATH
  12722. +do
  12723. +  IFS=$as_save_IFS
  12724. +  test -z "$as_dir" && as_dir=.
  12725. +  for ac_exec_ext in '' $ac_executable_extensions; do
  12726. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  12727. +    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
  12728. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  12729. +    break 2
  12730. +  fi
  12731. +done
  12732. +done
  12733. +
  12734. +fi
  12735. +fi
  12736. +RANLIB=$ac_cv_prog_RANLIB
  12737. +if test -n "$RANLIB"; then
  12738. +  echo "$as_me:$LINENO: result: $RANLIB" >&5
  12739. +echo "${ECHO_T}$RANLIB" >&6
  12740. +else
  12741. +  echo "$as_me:$LINENO: result: no" >&5
  12742. +echo "${ECHO_T}no" >&6
  12743. +fi
  12744. +
  12745. +fi
  12746. +if test -z "$ac_cv_prog_RANLIB"; then
  12747. +  ac_ct_RANLIB=$RANLIB
  12748. +  # Extract the first word of "ranlib", so it can be a program name with args.
  12749. +set dummy ranlib; ac_word=$2
  12750. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  12751. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  12752. +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
  12753. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12754. +else
  12755. +  if test -n "$ac_ct_RANLIB"; then
  12756. +  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
  12757. +else
  12758. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  12759. +for as_dir in $PATH
  12760. +do
  12761. +  IFS=$as_save_IFS
  12762. +  test -z "$as_dir" && as_dir=.
  12763. +  for ac_exec_ext in '' $ac_executable_extensions; do
  12764. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  12765. +    ac_cv_prog_ac_ct_RANLIB="ranlib"
  12766. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  12767. +    break 2
  12768. +  fi
  12769. +done
  12770. +done
  12771. +
  12772. +  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
  12773. +fi
  12774. +fi
  12775. +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
  12776. +if test -n "$ac_ct_RANLIB"; then
  12777. +  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
  12778. +echo "${ECHO_T}$ac_ct_RANLIB" >&6
  12779. +else
  12780. +  echo "$as_me:$LINENO: result: no" >&5
  12781. +echo "${ECHO_T}no" >&6
  12782. +fi
  12783.  
  12784. +  RANLIB=$ac_ct_RANLIB
  12785. +else
  12786. +  RANLIB="$ac_cv_prog_RANLIB"
  12787. +fi
  12788.  
  12789. -ALL_LINGUAS="fr tr ja es sv da zh_CN"
  12790. -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
  12791. -echo "configure:2713: checking how to run the C preprocessor" >&5
  12792. +ac_ext=c
  12793. +ac_cpp='$CPP $CPPFLAGS'
  12794. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  12795. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  12796. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  12797. +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
  12798. +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
  12799.  # On Suns, sometimes $CPP names a directory.
  12800.  if test -n "$CPP" && test -d "$CPP"; then
  12801.    CPP=
  12802.  fi
  12803.  if test -z "$CPP"; then
  12804. -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
  12805. -  echo $ac_n "(cached) $ac_c" 1>&6
  12806. +  if test "${ac_cv_prog_CPP+set}" = set; then
  12807. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  12808.  else
  12809. -    # This must be in double quotes, not single quotes, because CPP may get
  12810. -  # substituted into the Makefile and "${CC-cc}" will confuse make.
  12811. -  CPP="${CC-cc} -E"
  12812. +      # Double quotes because CPP needs to be expanded
  12813. +    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
  12814. +    do
  12815. +      ac_preproc_ok=false
  12816. +for ac_c_preproc_warn_flag in '' yes
  12817. +do
  12818. +  # Use a header file that comes with gcc, so configuring glibc
  12819. +  # with a fresh cross-compiler works.
  12820. +  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  12821. +  # <limits.h> exists even on freestanding compilers.
  12822.    # On the NeXT, cc -E runs the code through the compiler's parser,
  12823. -  # not just through cpp.
  12824. -  cat > conftest.$ac_ext <<EOF
  12825. -#line 2728 "configure"
  12826. -#include "confdefs.h"
  12827. -#include <assert.h>
  12828. -Syntax Error
  12829. -EOF
  12830. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  12831. -{ (eval echo configure:2734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  12832. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  12833. -if test -z "$ac_err"; then
  12834. -  :
  12835. -else
  12836. -  echo "$ac_err" >&5
  12837. -  echo "configure: failed program was:" >&5
  12838. -  cat conftest.$ac_ext >&5
  12839. -  rm -rf conftest*
  12840. -  CPP="${CC-cc} -E -traditional-cpp"
  12841. -  cat > conftest.$ac_ext <<EOF
  12842. -#line 2745 "configure"
  12843. -#include "confdefs.h"
  12844. -#include <assert.h>
  12845. -Syntax Error
  12846. -EOF
  12847. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  12848. -{ (eval echo configure:2751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  12849. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  12850. -if test -z "$ac_err"; then
  12851. -  :
  12852. +  # not just through cpp. "Syntax error" is here to catch this case.
  12853. +  cat >conftest.$ac_ext <<_ACEOF
  12854. +#line $LINENO "configure"
  12855. +/* confdefs.h.  */
  12856. +_ACEOF
  12857. +cat confdefs.h >>conftest.$ac_ext
  12858. +cat >>conftest.$ac_ext <<_ACEOF
  12859. +/* end confdefs.h.  */
  12860. +#ifdef __STDC__
  12861. +# include <limits.h>
  12862. +#else
  12863. +# include <assert.h>
  12864. +#endif
  12865. +                     Syntax error
  12866. +_ACEOF
  12867. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  12868. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  12869. +  ac_status=$?
  12870. +  grep -v '^ *+' conftest.er1 >conftest.err
  12871. +  rm -f conftest.er1
  12872. +  cat conftest.err >&5
  12873. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12874. +  (exit $ac_status); } >/dev/null; then
  12875. +  if test -s conftest.err; then
  12876. +    ac_cpp_err=$ac_c_preproc_warn_flag
  12877. +  else
  12878. +    ac_cpp_err=
  12879. +  fi
  12880.  else
  12881. -  echo "$ac_err" >&5
  12882. -  echo "configure: failed program was:" >&5
  12883. -  cat conftest.$ac_ext >&5
  12884. -  rm -rf conftest*
  12885. -  CPP="${CC-cc} -nologo -E"
  12886. -  cat > conftest.$ac_ext <<EOF
  12887. -#line 2762 "configure"
  12888. -#include "confdefs.h"
  12889. -#include <assert.h>
  12890. -Syntax Error
  12891. -EOF
  12892. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  12893. -{ (eval echo configure:2768: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  12894. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  12895. -if test -z "$ac_err"; then
  12896. +  ac_cpp_err=yes
  12897. +fi
  12898. +if test -z "$ac_cpp_err"; then
  12899.    :
  12900.  else
  12901. -  echo "$ac_err" >&5
  12902. -  echo "configure: failed program was:" >&5
  12903. -  cat conftest.$ac_ext >&5
  12904. -  rm -rf conftest*
  12905. -  CPP=/lib/cpp
  12906. +  echo "$as_me: failed program was:" >&5
  12907. +sed 's/^/| /' conftest.$ac_ext >&5
  12908. +
  12909. +  # Broken: fails on valid input.
  12910. +continue
  12911.  fi
  12912. -rm -f conftest*
  12913. +rm -f conftest.err conftest.$ac_ext
  12914. +
  12915. +  # OK, works on sane cases.  Now check whether non-existent headers
  12916. +  # can be detected and how.
  12917. +  cat >conftest.$ac_ext <<_ACEOF
  12918. +#line $LINENO "configure"
  12919. +/* confdefs.h.  */
  12920. +_ACEOF
  12921. +cat confdefs.h >>conftest.$ac_ext
  12922. +cat >>conftest.$ac_ext <<_ACEOF
  12923. +/* end confdefs.h.  */
  12924. +#include <ac_nonexistent.h>
  12925. +_ACEOF
  12926. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  12927. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  12928. +  ac_status=$?
  12929. +  grep -v '^ *+' conftest.er1 >conftest.err
  12930. +  rm -f conftest.er1
  12931. +  cat conftest.err >&5
  12932. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  12933. +  (exit $ac_status); } >/dev/null; then
  12934. +  if test -s conftest.err; then
  12935. +    ac_cpp_err=$ac_c_preproc_warn_flag
  12936. +  else
  12937. +    ac_cpp_err=
  12938. +  fi
  12939. +else
  12940. +  ac_cpp_err=yes
  12941. +fi
  12942. +if test -z "$ac_cpp_err"; then
  12943. +  # Broken: success on invalid input.
  12944. +continue
  12945. +else
  12946. +  echo "$as_me: failed program was:" >&5
  12947. +sed 's/^/| /' conftest.$ac_ext >&5
  12948. +
  12949. +  # Passes both tests.
  12950. +ac_preproc_ok=:
  12951. +break
  12952.  fi
  12953. -rm -f conftest*
  12954. +rm -f conftest.err conftest.$ac_ext
  12955. +
  12956. +done
  12957. +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
  12958. +rm -f conftest.err conftest.$ac_ext
  12959. +if $ac_preproc_ok; then
  12960. +  break
  12961.  fi
  12962. -rm -f conftest*
  12963. -  ac_cv_prog_CPP="$CPP"
  12964. +
  12965. +    done
  12966. +    ac_cv_prog_CPP=$CPP
  12967. +
  12968.  fi
  12969. -  CPP="$ac_cv_prog_CPP"
  12970. +  CPP=$ac_cv_prog_CPP
  12971.  else
  12972. -  ac_cv_prog_CPP="$CPP"
  12973. +  ac_cv_prog_CPP=$CPP
  12974.  fi
  12975. -echo "$ac_t""$CPP" 1>&6
  12976. -
  12977. -# Extract the first word of "ranlib", so it can be a program name with args.
  12978. -set dummy ranlib; ac_word=$2
  12979. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  12980. -echo "configure:2795: checking for $ac_word" >&5
  12981. -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  12982. -  echo $ac_n "(cached) $ac_c" 1>&6
  12983. +echo "$as_me:$LINENO: result: $CPP" >&5
  12984. +echo "${ECHO_T}$CPP" >&6
  12985. +ac_preproc_ok=false
  12986. +for ac_c_preproc_warn_flag in '' yes
  12987. +do
  12988. +  # Use a header file that comes with gcc, so configuring glibc
  12989. +  # with a fresh cross-compiler works.
  12990. +  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  12991. +  # <limits.h> exists even on freestanding compilers.
  12992. +  # On the NeXT, cc -E runs the code through the compiler's parser,
  12993. +  # not just through cpp. "Syntax error" is here to catch this case.
  12994. +  cat >conftest.$ac_ext <<_ACEOF
  12995. +#line $LINENO "configure"
  12996. +/* confdefs.h.  */
  12997. +_ACEOF
  12998. +cat confdefs.h >>conftest.$ac_ext
  12999. +cat >>conftest.$ac_ext <<_ACEOF
  13000. +/* end confdefs.h.  */
  13001. +#ifdef __STDC__
  13002. +# include <limits.h>
  13003. +#else
  13004. +# include <assert.h>
  13005. +#endif
  13006. +                     Syntax error
  13007. +_ACEOF
  13008. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  13009. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  13010. +  ac_status=$?
  13011. +  grep -v '^ *+' conftest.er1 >conftest.err
  13012. +  rm -f conftest.er1
  13013. +  cat conftest.err >&5
  13014. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13015. +  (exit $ac_status); } >/dev/null; then
  13016. +  if test -s conftest.err; then
  13017. +    ac_cpp_err=$ac_c_preproc_warn_flag
  13018. +  else
  13019. +    ac_cpp_err=
  13020. +  fi
  13021.  else
  13022. -  if test -n "$RANLIB"; then
  13023. -  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
  13024. +  ac_cpp_err=yes
  13025. +fi
  13026. +if test -z "$ac_cpp_err"; then
  13027. +  :
  13028.  else
  13029. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  13030. -  ac_dummy="$PATH"
  13031. -  for ac_dir in $ac_dummy; do
  13032. -    test -z "$ac_dir" && ac_dir=.
  13033. -    if test -f $ac_dir/$ac_word; then
  13034. -      ac_cv_prog_RANLIB="ranlib"
  13035. -      break
  13036. -    fi
  13037. -  done
  13038. -  IFS="$ac_save_ifs"
  13039. -  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
  13040. +  echo "$as_me: failed program was:" >&5
  13041. +sed 's/^/| /' conftest.$ac_ext >&5
  13042. +
  13043. +  # Broken: fails on valid input.
  13044. +continue
  13045.  fi
  13046. +rm -f conftest.err conftest.$ac_ext
  13047. +
  13048. +  # OK, works on sane cases.  Now check whether non-existent headers
  13049. +  # can be detected and how.
  13050. +  cat >conftest.$ac_ext <<_ACEOF
  13051. +#line $LINENO "configure"
  13052. +/* confdefs.h.  */
  13053. +_ACEOF
  13054. +cat confdefs.h >>conftest.$ac_ext
  13055. +cat >>conftest.$ac_ext <<_ACEOF
  13056. +/* end confdefs.h.  */
  13057. +#include <ac_nonexistent.h>
  13058. +_ACEOF
  13059. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  13060. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  13061. +  ac_status=$?
  13062. +  grep -v '^ *+' conftest.er1 >conftest.err
  13063. +  rm -f conftest.er1
  13064. +  cat conftest.err >&5
  13065. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13066. +  (exit $ac_status); } >/dev/null; then
  13067. +  if test -s conftest.err; then
  13068. +    ac_cpp_err=$ac_c_preproc_warn_flag
  13069. +  else
  13070. +    ac_cpp_err=
  13071. +  fi
  13072. +else
  13073. +  ac_cpp_err=yes
  13074. +fi
  13075. +if test -z "$ac_cpp_err"; then
  13076. +  # Broken: success on invalid input.
  13077. +continue
  13078. +else
  13079. +  echo "$as_me: failed program was:" >&5
  13080. +sed 's/^/| /' conftest.$ac_ext >&5
  13081. +
  13082. +  # Passes both tests.
  13083. +ac_preproc_ok=:
  13084. +break
  13085.  fi
  13086. -RANLIB="$ac_cv_prog_RANLIB"
  13087. -if test -n "$RANLIB"; then
  13088. -  echo "$ac_t""$RANLIB" 1>&6
  13089. +rm -f conftest.err conftest.$ac_ext
  13090. +
  13091. +done
  13092. +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
  13093. +rm -f conftest.err conftest.$ac_ext
  13094. +if $ac_preproc_ok; then
  13095. +  :
  13096.  else
  13097. -  echo "$ac_t""no" 1>&6
  13098. +  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
  13099. +See \`config.log' for more details." >&5
  13100. +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
  13101. +See \`config.log' for more details." >&2;}
  13102. +   { (exit 1); exit 1; }; }
  13103.  fi
  13104.  
  13105. -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
  13106. -echo "configure:2823: checking for ANSI C header files" >&5
  13107. -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
  13108. -  echo $ac_n "(cached) $ac_c" 1>&6
  13109. -else
  13110. -  cat > conftest.$ac_ext <<EOF
  13111. -#line 2828 "configure"
  13112. -#include "confdefs.h"
  13113. +ac_ext=c
  13114. +ac_cpp='$CPP $CPPFLAGS'
  13115. +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  13116. +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  13117. +ac_compiler_gnu=$ac_cv_c_compiler_gnu
  13118. +
  13119. +
  13120. +echo "$as_me:$LINENO: checking for egrep" >&5
  13121. +echo $ECHO_N "checking for egrep... $ECHO_C" >&6
  13122. +if test "${ac_cv_prog_egrep+set}" = set; then
  13123. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13124. +else
  13125. +  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
  13126. +    then ac_cv_prog_egrep='grep -E'
  13127. +    else ac_cv_prog_egrep='egrep'
  13128. +    fi
  13129. +fi
  13130. +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
  13131. +echo "${ECHO_T}$ac_cv_prog_egrep" >&6
  13132. + EGREP=$ac_cv_prog_egrep
  13133. +
  13134. +
  13135. +echo "$as_me:$LINENO: checking for ANSI C header files" >&5
  13136. +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
  13137. +if test "${ac_cv_header_stdc+set}" = set; then
  13138. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13139. +else
  13140. +  cat >conftest.$ac_ext <<_ACEOF
  13141. +#line $LINENO "configure"
  13142. +/* confdefs.h.  */
  13143. +_ACEOF
  13144. +cat confdefs.h >>conftest.$ac_ext
  13145. +cat >>conftest.$ac_ext <<_ACEOF
  13146. +/* end confdefs.h.  */
  13147.  #include <stdlib.h>
  13148.  #include <stdarg.h>
  13149.  #include <string.h>
  13150.  #include <float.h>
  13151. -EOF
  13152. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  13153. -{ (eval echo configure:2836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  13154. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  13155. -if test -z "$ac_err"; then
  13156. -  rm -rf conftest*
  13157. +
  13158. +int
  13159. +main ()
  13160. +{
  13161. +
  13162. +  ;
  13163. +  return 0;
  13164. +}
  13165. +_ACEOF
  13166. +rm -f conftest.$ac_objext
  13167. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  13168. +  (eval $ac_compile) 2>&5
  13169. +  ac_status=$?
  13170. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13171. +  (exit $ac_status); } &&
  13172. +         { ac_try='test -s conftest.$ac_objext'
  13173. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13174. +  (eval $ac_try) 2>&5
  13175. +  ac_status=$?
  13176. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13177. +  (exit $ac_status); }; }; then
  13178.    ac_cv_header_stdc=yes
  13179.  else
  13180. -  echo "$ac_err" >&5
  13181. -  echo "configure: failed program was:" >&5
  13182. -  cat conftest.$ac_ext >&5
  13183. -  rm -rf conftest*
  13184. -  ac_cv_header_stdc=no
  13185. +  echo "$as_me: failed program was:" >&5
  13186. +sed 's/^/| /' conftest.$ac_ext >&5
  13187. +
  13188. +ac_cv_header_stdc=no
  13189.  fi
  13190. -rm -f conftest*
  13191. +rm -f conftest.$ac_objext conftest.$ac_ext
  13192.  
  13193.  if test $ac_cv_header_stdc = yes; then
  13194.    # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  13195. -cat > conftest.$ac_ext <<EOF
  13196. -#line 2853 "configure"
  13197. -#include "confdefs.h"
  13198. +  cat >conftest.$ac_ext <<_ACEOF
  13199. +#line $LINENO "configure"
  13200. +/* confdefs.h.  */
  13201. +_ACEOF
  13202. +cat confdefs.h >>conftest.$ac_ext
  13203. +cat >>conftest.$ac_ext <<_ACEOF
  13204. +/* end confdefs.h.  */
  13205.  #include <string.h>
  13206. -EOF
  13207. +
  13208. +_ACEOF
  13209.  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  13210. -  egrep "memchr" >/dev/null 2>&1; then
  13211. +  $EGREP "memchr" >/dev/null 2>&1; then
  13212.    :
  13213.  else
  13214. -  rm -rf conftest*
  13215.    ac_cv_header_stdc=no
  13216.  fi
  13217.  rm -f conftest*
  13218. @@ -2866,16 +5183,20 @@
  13219.  
  13220.  if test $ac_cv_header_stdc = yes; then
  13221.    # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  13222. -cat > conftest.$ac_ext <<EOF
  13223. -#line 2871 "configure"
  13224. -#include "confdefs.h"
  13225. +  cat >conftest.$ac_ext <<_ACEOF
  13226. +#line $LINENO "configure"
  13227. +/* confdefs.h.  */
  13228. +_ACEOF
  13229. +cat confdefs.h >>conftest.$ac_ext
  13230. +cat >>conftest.$ac_ext <<_ACEOF
  13231. +/* end confdefs.h.  */
  13232.  #include <stdlib.h>
  13233. -EOF
  13234. +
  13235. +_ACEOF
  13236.  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  13237. -  egrep "free" >/dev/null 2>&1; then
  13238. +  $EGREP "free" >/dev/null 2>&1; then
  13239.    :
  13240.  else
  13241. -  rm -rf conftest*
  13242.    ac_cv_header_stdc=no
  13243.  fi
  13244.  rm -f conftest*
  13245. @@ -2884,269 +5205,473 @@
  13246.  
  13247.  if test $ac_cv_header_stdc = yes; then
  13248.    # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  13249. -if test "$cross_compiling" = yes; then
  13250. +  if test "$cross_compiling" = yes; then
  13251.    :
  13252.  else
  13253. -  cat > conftest.$ac_ext <<EOF
  13254. -#line 2892 "configure"
  13255. -#include "confdefs.h"
  13256. +  cat >conftest.$ac_ext <<_ACEOF
  13257. +#line $LINENO "configure"
  13258. +/* confdefs.h.  */
  13259. +_ACEOF
  13260. +cat confdefs.h >>conftest.$ac_ext
  13261. +cat >>conftest.$ac_ext <<_ACEOF
  13262. +/* end confdefs.h.  */
  13263.  #include <ctype.h>
  13264. -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  13265. -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  13266. -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
  13267. -int main () { int i; for (i = 0; i < 256; i++)
  13268. -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  13269. -exit (0); }
  13270. +#if ((' ' & 0x0FF) == 0x020)
  13271. +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  13272. +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  13273. +#else
  13274. +# define ISLOWER(c) \
  13275. +                   (('a' <= (c) && (c) <= 'i') \
  13276. +                     || ('j' <= (c) && (c) <= 'r') \
  13277. +                     || ('s' <= (c) && (c) <= 'z'))
  13278. +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
  13279. +#endif
  13280.  
  13281. -EOF
  13282. -if { (eval echo configure:2903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  13283. -then
  13284. +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
  13285. +int
  13286. +main ()
  13287. +{
  13288. +  int i;
  13289. +  for (i = 0; i < 256; i++)
  13290. +    if (XOR (islower (i), ISLOWER (i))
  13291. +        || toupper (i) != TOUPPER (i))
  13292. +      exit(2);
  13293. +  exit (0);
  13294. +}
  13295. +_ACEOF
  13296. +rm -f conftest$ac_exeext
  13297. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  13298. +  (eval $ac_link) 2>&5
  13299. +  ac_status=$?
  13300. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13301. +  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  13302. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13303. +  (eval $ac_try) 2>&5
  13304. +  ac_status=$?
  13305. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13306. +  (exit $ac_status); }; }; then
  13307.    :
  13308.  else
  13309. -  echo "configure: failed program was:" >&5
  13310. -  cat conftest.$ac_ext >&5
  13311. -  rm -fr conftest*
  13312. -  ac_cv_header_stdc=no
  13313. +  echo "$as_me: program exited with status $ac_status" >&5
  13314. +echo "$as_me: failed program was:" >&5
  13315. +sed 's/^/| /' conftest.$ac_ext >&5
  13316. +
  13317. +( exit $ac_status )
  13318. +ac_cv_header_stdc=no
  13319.  fi
  13320. -rm -fr conftest*
  13321. +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
  13322.  fi
  13323. -
  13324.  fi
  13325.  fi
  13326. -
  13327. -echo "$ac_t""$ac_cv_header_stdc" 1>&6
  13328. +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
  13329. +echo "${ECHO_T}$ac_cv_header_stdc" >&6
  13330.  if test $ac_cv_header_stdc = yes; then
  13331. -  cat >> confdefs.h <<\EOF
  13332. +
  13333. +cat >>confdefs.h <<\_ACEOF
  13334.  #define STDC_HEADERS 1
  13335. -EOF
  13336. +_ACEOF
  13337.  
  13338.  fi
  13339.  
  13340. -echo $ac_n "checking for working const""... $ac_c" 1>&6
  13341. -echo "configure:2927: checking for working const" >&5
  13342. -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
  13343. -  echo $ac_n "(cached) $ac_c" 1>&6
  13344. -else
  13345. -  cat > conftest.$ac_ext <<EOF
  13346. -#line 2932 "configure"
  13347. -#include "confdefs.h"
  13348. -
  13349. -int main() {
  13350. -
  13351. -/* Ultrix mips cc rejects this.  */
  13352. -typedef int charset[2]; const charset x;
  13353. -/* SunOS 4.1.1 cc rejects this.  */
  13354. -char const *const *ccp;
  13355. -char **p;
  13356. -/* NEC SVR4.0.2 mips cc rejects this.  */
  13357. -struct point {int x, y;};
  13358. -static struct point const zero = {0,0};
  13359. -/* AIX XL C 1.02.0.0 rejects this.
  13360. -   It does not let you subtract one const X* pointer from another in an arm
  13361. -   of an if-expression whose if-part is not a constant expression */
  13362. -const char *g = "string";
  13363. -ccp = &g + (g ? g-g : 0);
  13364. -/* HPUX 7.0 cc rejects these. */
  13365. -++ccp;
  13366. -p = (char**) ccp;
  13367. -ccp = (char const *const *) p;
  13368. -{ /* SCO 3.2v4 cc rejects this.  */
  13369. +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
  13370. +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
  13371. +if test "${ac_cv_c_const+set}" = set; then
  13372. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13373. +else
  13374. +  cat >conftest.$ac_ext <<_ACEOF
  13375. +#line $LINENO "configure"
  13376. +/* confdefs.h.  */
  13377. +_ACEOF
  13378. +cat confdefs.h >>conftest.$ac_ext
  13379. +cat >>conftest.$ac_ext <<_ACEOF
  13380. +/* end confdefs.h.  */
  13381. +
  13382. +int
  13383. +main ()
  13384. +{
  13385. +/* FIXME: Include the comments suggested by Paul. */
  13386. +#ifndef __cplusplus
  13387. +  /* Ultrix mips cc rejects this.  */
  13388. +  typedef int charset[2];
  13389. +  const charset x;
  13390. +  /* SunOS 4.1.1 cc rejects this.  */
  13391. +  char const *const *ccp;
  13392. +  char **p;
  13393. +  /* NEC SVR4.0.2 mips cc rejects this.  */
  13394. +  struct point {int x, y;};
  13395. +  static struct point const zero = {0,0};
  13396. +  /* AIX XL C 1.02.0.0 rejects this.
  13397. +     It does not let you subtract one const X* pointer from another in
  13398. +     an arm of an if-expression whose if-part is not a constant
  13399. +     expression */
  13400. +  const char *g = "string";
  13401. +  ccp = &g + (g ? g-g : 0);
  13402. +  /* HPUX 7.0 cc rejects these. */
  13403. +  ++ccp;
  13404. +  p = (char**) ccp;
  13405. +  ccp = (char const *const *) p;
  13406. +  { /* SCO 3.2v4 cc rejects this.  */
  13407.    char *t;
  13408.    char const *s = 0 ? (char *) 0 : (char const *) 0;
  13409.  
  13410.    *t++ = 0;
  13411. -}
  13412. -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  13413. +  }
  13414. +  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  13415.    int x[] = {25, 17};
  13416.    const int *foo = &x[0];
  13417.    ++foo;
  13418. -}
  13419. -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  13420. +  }
  13421. +  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  13422.    typedef const int *iptr;
  13423.    iptr p = 0;
  13424.    ++p;
  13425. -}
  13426. -{ /* AIX XL C 1.02.0.0 rejects this saying
  13427. +  }
  13428. +  { /* AIX XL C 1.02.0.0 rejects this saying
  13429.       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  13430.    struct s { int j; const int *ap[3]; };
  13431.    struct s *b; b->j = 5;
  13432. -}
  13433. -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  13434. +  }
  13435. +  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  13436.    const int foo = 10;
  13437. -}
  13438. +  }
  13439. +#endif
  13440.  
  13441. -; return 0; }
  13442. -EOF
  13443. -if { (eval echo configure:2981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  13444. -  rm -rf conftest*
  13445. +  ;
  13446. +  return 0;
  13447. +}
  13448. +_ACEOF
  13449. +rm -f conftest.$ac_objext
  13450. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  13451. +  (eval $ac_compile) 2>&5
  13452. +  ac_status=$?
  13453. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13454. +  (exit $ac_status); } &&
  13455. +         { ac_try='test -s conftest.$ac_objext'
  13456. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13457. +  (eval $ac_try) 2>&5
  13458. +  ac_status=$?
  13459. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13460. +  (exit $ac_status); }; }; then
  13461.    ac_cv_c_const=yes
  13462.  else
  13463. -  echo "configure: failed program was:" >&5
  13464. -  cat conftest.$ac_ext >&5
  13465. -  rm -rf conftest*
  13466. -  ac_cv_c_const=no
  13467. +  echo "$as_me: failed program was:" >&5
  13468. +sed 's/^/| /' conftest.$ac_ext >&5
  13469. +
  13470. +ac_cv_c_const=no
  13471.  fi
  13472. -rm -f conftest*
  13473. +rm -f conftest.$ac_objext conftest.$ac_ext
  13474.  fi
  13475. -
  13476. -echo "$ac_t""$ac_cv_c_const" 1>&6
  13477. +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
  13478. +echo "${ECHO_T}$ac_cv_c_const" >&6
  13479.  if test $ac_cv_c_const = no; then
  13480. -  cat >> confdefs.h <<\EOF
  13481. +
  13482. +cat >>confdefs.h <<\_ACEOF
  13483.  #define const 
  13484. -EOF
  13485. +_ACEOF
  13486.  
  13487.  fi
  13488.  
  13489. -echo $ac_n "checking for inline""... $ac_c" 1>&6
  13490. -echo "configure:3002: checking for inline" >&5
  13491. -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
  13492. -  echo $ac_n "(cached) $ac_c" 1>&6
  13493. +echo "$as_me:$LINENO: checking for inline" >&5
  13494. +echo $ECHO_N "checking for inline... $ECHO_C" >&6
  13495. +if test "${ac_cv_c_inline+set}" = set; then
  13496. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13497.  else
  13498.    ac_cv_c_inline=no
  13499.  for ac_kw in inline __inline__ __inline; do
  13500. -  cat > conftest.$ac_ext <<EOF
  13501. -#line 3009 "configure"
  13502. -#include "confdefs.h"
  13503. -
  13504. -int main() {
  13505. -} $ac_kw foo() {
  13506. -; return 0; }
  13507. -EOF
  13508. -if { (eval echo configure:3016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  13509. -  rm -rf conftest*
  13510. +  cat >conftest.$ac_ext <<_ACEOF
  13511. +#line $LINENO "configure"
  13512. +/* confdefs.h.  */
  13513. +_ACEOF
  13514. +cat confdefs.h >>conftest.$ac_ext
  13515. +cat >>conftest.$ac_ext <<_ACEOF
  13516. +/* end confdefs.h.  */
  13517. +#ifndef __cplusplus
  13518. +typedef int foo_t;
  13519. +static $ac_kw foo_t static_foo () {return 0; }
  13520. +$ac_kw foo_t foo () {return 0; }
  13521. +#endif
  13522. +
  13523. +_ACEOF
  13524. +rm -f conftest.$ac_objext
  13525. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  13526. +  (eval $ac_compile) 2>&5
  13527. +  ac_status=$?
  13528. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13529. +  (exit $ac_status); } &&
  13530. +         { ac_try='test -s conftest.$ac_objext'
  13531. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13532. +  (eval $ac_try) 2>&5
  13533. +  ac_status=$?
  13534. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13535. +  (exit $ac_status); }; }; then
  13536.    ac_cv_c_inline=$ac_kw; break
  13537.  else
  13538. -  echo "configure: failed program was:" >&5
  13539. -  cat conftest.$ac_ext >&5
  13540. +  echo "$as_me: failed program was:" >&5
  13541. +sed 's/^/| /' conftest.$ac_ext >&5
  13542. +
  13543.  fi
  13544. -rm -f conftest*
  13545. +rm -f conftest.$ac_objext conftest.$ac_ext
  13546.  done
  13547.  
  13548.  fi
  13549. -
  13550. -echo "$ac_t""$ac_cv_c_inline" 1>&6
  13551. -case "$ac_cv_c_inline" in
  13552. +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
  13553. +echo "${ECHO_T}$ac_cv_c_inline" >&6
  13554. +case $ac_cv_c_inline in
  13555.    inline | yes) ;;
  13556. -  no) cat >> confdefs.h <<\EOF
  13557. +  no)
  13558. +cat >>confdefs.h <<\_ACEOF
  13559.  #define inline 
  13560. -EOF
  13561. +_ACEOF
  13562.   ;;
  13563. -  *)  cat >> confdefs.h <<EOF
  13564. +  *)  cat >>confdefs.h <<_ACEOF
  13565.  #define inline $ac_cv_c_inline
  13566. -EOF
  13567. +_ACEOF
  13568.   ;;
  13569.  esac
  13570.  
  13571. -echo $ac_n "checking for off_t""... $ac_c" 1>&6
  13572. -echo "configure:3042: checking for off_t" >&5
  13573. -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
  13574. -  echo $ac_n "(cached) $ac_c" 1>&6
  13575. -else
  13576. -  cat > conftest.$ac_ext <<EOF
  13577. -#line 3047 "configure"
  13578. -#include "confdefs.h"
  13579. -#include <sys/types.h>
  13580. -#if STDC_HEADERS
  13581. -#include <stdlib.h>
  13582. -#include <stddef.h>
  13583. -#endif
  13584. -EOF
  13585. -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  13586. -  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  13587. -  rm -rf conftest*
  13588. +# On IRIX 5.3, sys/types and inttypes.h are conflicting.
  13589. +
  13590. +
  13591. +
  13592. +
  13593. +
  13594. +
  13595. +
  13596. +
  13597. +
  13598. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
  13599. +                  inttypes.h stdint.h unistd.h
  13600. +do
  13601. +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  13602. +echo "$as_me:$LINENO: checking for $ac_header" >&5
  13603. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  13604. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  13605. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13606. +else
  13607. +  cat >conftest.$ac_ext <<_ACEOF
  13608. +#line $LINENO "configure"
  13609. +/* confdefs.h.  */
  13610. +_ACEOF
  13611. +cat confdefs.h >>conftest.$ac_ext
  13612. +cat >>conftest.$ac_ext <<_ACEOF
  13613. +/* end confdefs.h.  */
  13614. +$ac_includes_default
  13615. +
  13616. +#include <$ac_header>
  13617. +_ACEOF
  13618. +rm -f conftest.$ac_objext
  13619. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  13620. +  (eval $ac_compile) 2>&5
  13621. +  ac_status=$?
  13622. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13623. +  (exit $ac_status); } &&
  13624. +         { ac_try='test -s conftest.$ac_objext'
  13625. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13626. +  (eval $ac_try) 2>&5
  13627. +  ac_status=$?
  13628. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13629. +  (exit $ac_status); }; }; then
  13630. +  eval "$as_ac_Header=yes"
  13631. +else
  13632. +  echo "$as_me: failed program was:" >&5
  13633. +sed 's/^/| /' conftest.$ac_ext >&5
  13634. +
  13635. +eval "$as_ac_Header=no"
  13636. +fi
  13637. +rm -f conftest.$ac_objext conftest.$ac_ext
  13638. +fi
  13639. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  13640. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  13641. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  13642. +  cat >>confdefs.h <<_ACEOF
  13643. +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  13644. +_ACEOF
  13645. +
  13646. +fi
  13647. +
  13648. +done
  13649. +
  13650. +
  13651. +echo "$as_me:$LINENO: checking for off_t" >&5
  13652. +echo $ECHO_N "checking for off_t... $ECHO_C" >&6
  13653. +if test "${ac_cv_type_off_t+set}" = set; then
  13654. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13655. +else
  13656. +  cat >conftest.$ac_ext <<_ACEOF
  13657. +#line $LINENO "configure"
  13658. +/* confdefs.h.  */
  13659. +_ACEOF
  13660. +cat confdefs.h >>conftest.$ac_ext
  13661. +cat >>conftest.$ac_ext <<_ACEOF
  13662. +/* end confdefs.h.  */
  13663. +$ac_includes_default
  13664. +int
  13665. +main ()
  13666. +{
  13667. +if ((off_t *) 0)
  13668. +  return 0;
  13669. +if (sizeof (off_t))
  13670. +  return 0;
  13671. +  ;
  13672. +  return 0;
  13673. +}
  13674. +_ACEOF
  13675. +rm -f conftest.$ac_objext
  13676. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  13677. +  (eval $ac_compile) 2>&5
  13678. +  ac_status=$?
  13679. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13680. +  (exit $ac_status); } &&
  13681. +         { ac_try='test -s conftest.$ac_objext'
  13682. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13683. +  (eval $ac_try) 2>&5
  13684. +  ac_status=$?
  13685. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13686. +  (exit $ac_status); }; }; then
  13687.    ac_cv_type_off_t=yes
  13688.  else
  13689. -  rm -rf conftest*
  13690. -  ac_cv_type_off_t=no
  13691. -fi
  13692. -rm -f conftest*
  13693. +  echo "$as_me: failed program was:" >&5
  13694. +sed 's/^/| /' conftest.$ac_ext >&5
  13695.  
  13696. +ac_cv_type_off_t=no
  13697. +fi
  13698. +rm -f conftest.$ac_objext conftest.$ac_ext
  13699.  fi
  13700. -echo "$ac_t""$ac_cv_type_off_t" 1>&6
  13701. -if test $ac_cv_type_off_t = no; then
  13702. -  cat >> confdefs.h <<\EOF
  13703. +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
  13704. +echo "${ECHO_T}$ac_cv_type_off_t" >&6
  13705. +if test $ac_cv_type_off_t = yes; then
  13706. +  :
  13707. +else
  13708. +
  13709. +cat >>confdefs.h <<_ACEOF
  13710.  #define off_t long
  13711. -EOF
  13712. +_ACEOF
  13713.  
  13714.  fi
  13715.  
  13716. -echo $ac_n "checking for size_t""... $ac_c" 1>&6
  13717. -echo "configure:3075: checking for size_t" >&5
  13718. -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
  13719. -  echo $ac_n "(cached) $ac_c" 1>&6
  13720. -else
  13721. -  cat > conftest.$ac_ext <<EOF
  13722. -#line 3080 "configure"
  13723. -#include "confdefs.h"
  13724. -#include <sys/types.h>
  13725. -#if STDC_HEADERS
  13726. -#include <stdlib.h>
  13727. -#include <stddef.h>
  13728. -#endif
  13729. -EOF
  13730. -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  13731. -  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  13732. -  rm -rf conftest*
  13733. +echo "$as_me:$LINENO: checking for size_t" >&5
  13734. +echo $ECHO_N "checking for size_t... $ECHO_C" >&6
  13735. +if test "${ac_cv_type_size_t+set}" = set; then
  13736. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13737. +else
  13738. +  cat >conftest.$ac_ext <<_ACEOF
  13739. +#line $LINENO "configure"
  13740. +/* confdefs.h.  */
  13741. +_ACEOF
  13742. +cat confdefs.h >>conftest.$ac_ext
  13743. +cat >>conftest.$ac_ext <<_ACEOF
  13744. +/* end confdefs.h.  */
  13745. +$ac_includes_default
  13746. +int
  13747. +main ()
  13748. +{
  13749. +if ((size_t *) 0)
  13750. +  return 0;
  13751. +if (sizeof (size_t))
  13752. +  return 0;
  13753. +  ;
  13754. +  return 0;
  13755. +}
  13756. +_ACEOF
  13757. +rm -f conftest.$ac_objext
  13758. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  13759. +  (eval $ac_compile) 2>&5
  13760. +  ac_status=$?
  13761. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13762. +  (exit $ac_status); } &&
  13763. +         { ac_try='test -s conftest.$ac_objext'
  13764. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13765. +  (eval $ac_try) 2>&5
  13766. +  ac_status=$?
  13767. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13768. +  (exit $ac_status); }; }; then
  13769.    ac_cv_type_size_t=yes
  13770.  else
  13771. -  rm -rf conftest*
  13772. -  ac_cv_type_size_t=no
  13773. -fi
  13774. -rm -f conftest*
  13775. +  echo "$as_me: failed program was:" >&5
  13776. +sed 's/^/| /' conftest.$ac_ext >&5
  13777.  
  13778. +ac_cv_type_size_t=no
  13779.  fi
  13780. -echo "$ac_t""$ac_cv_type_size_t" 1>&6
  13781. -if test $ac_cv_type_size_t = no; then
  13782. -  cat >> confdefs.h <<\EOF
  13783. +rm -f conftest.$ac_objext conftest.$ac_ext
  13784. +fi
  13785. +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
  13786. +echo "${ECHO_T}$ac_cv_type_size_t" >&6
  13787. +if test $ac_cv_type_size_t = yes; then
  13788. +  :
  13789. +else
  13790. +
  13791. +cat >>confdefs.h <<_ACEOF
  13792.  #define size_t unsigned
  13793. -EOF
  13794. +_ACEOF
  13795.  
  13796.  fi
  13797.  
  13798.  # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  13799.  # for constant arguments.  Useless!
  13800. -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
  13801. -echo "configure:3110: checking for working alloca.h" >&5
  13802. -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
  13803. -  echo $ac_n "(cached) $ac_c" 1>&6
  13804. -else
  13805. -  cat > conftest.$ac_ext <<EOF
  13806. -#line 3115 "configure"
  13807. -#include "confdefs.h"
  13808. +echo "$as_me:$LINENO: checking for working alloca.h" >&5
  13809. +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6
  13810. +if test "${ac_cv_working_alloca_h+set}" = set; then
  13811. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13812. +else
  13813. +  cat >conftest.$ac_ext <<_ACEOF
  13814. +#line $LINENO "configure"
  13815. +/* confdefs.h.  */
  13816. +_ACEOF
  13817. +cat confdefs.h >>conftest.$ac_ext
  13818. +cat >>conftest.$ac_ext <<_ACEOF
  13819. +/* end confdefs.h.  */
  13820.  #include <alloca.h>
  13821. -int main() {
  13822. -char *p = alloca(2 * sizeof(int));
  13823. -; return 0; }
  13824. -EOF
  13825. -if { (eval echo configure:3122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  13826. -  rm -rf conftest*
  13827. -  ac_cv_header_alloca_h=yes
  13828. -else
  13829. -  echo "configure: failed program was:" >&5
  13830. -  cat conftest.$ac_ext >&5
  13831. -  rm -rf conftest*
  13832. -  ac_cv_header_alloca_h=no
  13833. -fi
  13834. -rm -f conftest*
  13835. -fi
  13836. +int
  13837. +main ()
  13838. +{
  13839. +char *p = (char *) alloca (2 * sizeof (int));
  13840. +  ;
  13841. +  return 0;
  13842. +}
  13843. +_ACEOF
  13844. +rm -f conftest.$ac_objext conftest$ac_exeext
  13845. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  13846. +  (eval $ac_link) 2>&5
  13847. +  ac_status=$?
  13848. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13849. +  (exit $ac_status); } &&
  13850. +         { ac_try='test -s conftest$ac_exeext'
  13851. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13852. +  (eval $ac_try) 2>&5
  13853. +  ac_status=$?
  13854. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13855. +  (exit $ac_status); }; }; then
  13856. +  ac_cv_working_alloca_h=yes
  13857. +else
  13858. +  echo "$as_me: failed program was:" >&5
  13859. +sed 's/^/| /' conftest.$ac_ext >&5
  13860. +
  13861. +ac_cv_working_alloca_h=no
  13862. +fi
  13863. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  13864. +fi
  13865. +echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
  13866. +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6
  13867. +if test $ac_cv_working_alloca_h = yes; then
  13868.  
  13869. -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
  13870. -if test $ac_cv_header_alloca_h = yes; then
  13871. -  cat >> confdefs.h <<\EOF
  13872. +cat >>confdefs.h <<\_ACEOF
  13873.  #define HAVE_ALLOCA_H 1
  13874. -EOF
  13875. +_ACEOF
  13876.  
  13877.  fi
  13878.  
  13879. -echo $ac_n "checking for alloca""... $ac_c" 1>&6
  13880. -echo "configure:3143: checking for alloca" >&5
  13881. -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
  13882. -  echo $ac_n "(cached) $ac_c" 1>&6
  13883. -else
  13884. -  cat > conftest.$ac_ext <<EOF
  13885. -#line 3148 "configure"
  13886. -#include "confdefs.h"
  13887. -
  13888. +echo "$as_me:$LINENO: checking for alloca" >&5
  13889. +echo $ECHO_N "checking for alloca... $ECHO_C" >&6
  13890. +if test "${ac_cv_func_alloca_works+set}" = set; then
  13891. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13892. +else
  13893. +  cat >conftest.$ac_ext <<_ACEOF
  13894. +#line $LINENO "configure"
  13895. +/* confdefs.h.  */
  13896. +_ACEOF
  13897. +cat confdefs.h >>conftest.$ac_ext
  13898. +cat >>conftest.$ac_ext <<_ACEOF
  13899. +/* end confdefs.h.  */
  13900.  #ifdef __GNUC__
  13901.  # define alloca __builtin_alloca
  13902.  #else
  13903. @@ -3168,137 +5693,190 @@
  13904.  # endif
  13905.  #endif
  13906.  
  13907. -int main() {
  13908. -char *p = (char *) alloca(1);
  13909. -; return 0; }
  13910. -EOF
  13911. -if { (eval echo configure:3176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  13912. -  rm -rf conftest*
  13913. +int
  13914. +main ()
  13915. +{
  13916. +char *p = (char *) alloca (1);
  13917. +  ;
  13918. +  return 0;
  13919. +}
  13920. +_ACEOF
  13921. +rm -f conftest.$ac_objext conftest$ac_exeext
  13922. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  13923. +  (eval $ac_link) 2>&5
  13924. +  ac_status=$?
  13925. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13926. +  (exit $ac_status); } &&
  13927. +         { ac_try='test -s conftest$ac_exeext'
  13928. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  13929. +  (eval $ac_try) 2>&5
  13930. +  ac_status=$?
  13931. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  13932. +  (exit $ac_status); }; }; then
  13933.    ac_cv_func_alloca_works=yes
  13934.  else
  13935. -  echo "configure: failed program was:" >&5
  13936. -  cat conftest.$ac_ext >&5
  13937. -  rm -rf conftest*
  13938. -  ac_cv_func_alloca_works=no
  13939. +  echo "$as_me: failed program was:" >&5
  13940. +sed 's/^/| /' conftest.$ac_ext >&5
  13941. +
  13942. +ac_cv_func_alloca_works=no
  13943.  fi
  13944. -rm -f conftest*
  13945. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  13946.  fi
  13947. +echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
  13948. +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6
  13949.  
  13950. -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
  13951.  if test $ac_cv_func_alloca_works = yes; then
  13952. -  cat >> confdefs.h <<\EOF
  13953. -#define HAVE_ALLOCA 1
  13954. -EOF
  13955.  
  13956. -fi
  13957. +cat >>confdefs.h <<\_ACEOF
  13958. +#define HAVE_ALLOCA 1
  13959. +_ACEOF
  13960.  
  13961. -if test $ac_cv_func_alloca_works = no; then
  13962. +else
  13963.    # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  13964. -  # that cause trouble.  Some versions do not even contain alloca or
  13965. -  # contain a buggy version.  If you still want to use their alloca,
  13966. -  # use ar to extract alloca.o from them instead of compiling alloca.c.
  13967. -  ALLOCA=alloca.${ac_objext}
  13968. -  cat >> confdefs.h <<\EOF
  13969. +# that cause trouble.  Some versions do not even contain alloca or
  13970. +# contain a buggy version.  If you still want to use their alloca,
  13971. +# use ar to extract alloca.o from them instead of compiling alloca.c.
  13972. +
  13973. +ALLOCA=alloca.$ac_objext
  13974. +
  13975. +cat >>confdefs.h <<\_ACEOF
  13976.  #define C_ALLOCA 1
  13977. -EOF
  13978. +_ACEOF
  13979.  
  13980.  
  13981. -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
  13982. -echo "configure:3208: checking whether alloca needs Cray hooks" >&5
  13983. -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
  13984. -  echo $ac_n "(cached) $ac_c" 1>&6
  13985. -else
  13986. -  cat > conftest.$ac_ext <<EOF
  13987. -#line 3213 "configure"
  13988. -#include "confdefs.h"
  13989. +echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
  13990. +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6
  13991. +if test "${ac_cv_os_cray+set}" = set; then
  13992. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  13993. +else
  13994. +  cat >conftest.$ac_ext <<_ACEOF
  13995. +#line $LINENO "configure"
  13996. +/* confdefs.h.  */
  13997. +_ACEOF
  13998. +cat confdefs.h >>conftest.$ac_ext
  13999. +cat >>conftest.$ac_ext <<_ACEOF
  14000. +/* end confdefs.h.  */
  14001.  #if defined(CRAY) && ! defined(CRAY2)
  14002.  webecray
  14003.  #else
  14004.  wenotbecray
  14005.  #endif
  14006.  
  14007. -EOF
  14008. +_ACEOF
  14009.  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  14010. -  egrep "webecray" >/dev/null 2>&1; then
  14011. -  rm -rf conftest*
  14012. +  $EGREP "webecray" >/dev/null 2>&1; then
  14013.    ac_cv_os_cray=yes
  14014.  else
  14015. -  rm -rf conftest*
  14016.    ac_cv_os_cray=no
  14017.  fi
  14018.  rm -f conftest*
  14019.  
  14020.  fi
  14021. -
  14022. -echo "$ac_t""$ac_cv_os_cray" 1>&6
  14023. +echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
  14024. +echo "${ECHO_T}$ac_cv_os_cray" >&6
  14025.  if test $ac_cv_os_cray = yes; then
  14026. -for ac_func in _getb67 GETB67 getb67; do
  14027. -  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  14028. -echo "configure:3238: checking for $ac_func" >&5
  14029. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  14030. -  echo $ac_n "(cached) $ac_c" 1>&6
  14031. -else
  14032. -  cat > conftest.$ac_ext <<EOF
  14033. -#line 3243 "configure"
  14034. -#include "confdefs.h"
  14035. +  for ac_func in _getb67 GETB67 getb67; do
  14036. +    as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  14037. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  14038. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  14039. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  14040. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14041. +else
  14042. +  cat >conftest.$ac_ext <<_ACEOF
  14043. +#line $LINENO "configure"
  14044. +/* confdefs.h.  */
  14045. +_ACEOF
  14046. +cat confdefs.h >>conftest.$ac_ext
  14047. +cat >>conftest.$ac_ext <<_ACEOF
  14048. +/* end confdefs.h.  */
  14049.  /* System header to define __stub macros and hopefully few prototypes,
  14050. -    which can conflict with char $ac_func(); below.  */
  14051. -#include <assert.h>
  14052. +    which can conflict with char $ac_func (); below.
  14053. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  14054. +    <limits.h> exists even on freestanding compilers.  */
  14055. +#ifdef __STDC__
  14056. +# include <limits.h>
  14057. +#else
  14058. +# include <assert.h>
  14059. +#endif
  14060.  /* Override any gcc2 internal prototype to avoid an error.  */
  14061. +#ifdef __cplusplus
  14062. +extern "C"
  14063. +{
  14064. +#endif
  14065.  /* We use char because int might match the return type of a gcc2
  14066.      builtin and then its argument prototype would still apply.  */
  14067. -char $ac_func();
  14068. -
  14069. -int main() {
  14070. -
  14071. +char $ac_func ();
  14072.  /* The GNU C library defines this for functions which it implements
  14073.      to always fail with ENOSYS.  Some functions are actually named
  14074.      something starting with __ and the normal name is an alias.  */
  14075.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  14076.  choke me
  14077.  #else
  14078. -$ac_func();
  14079. +char (*f) () = $ac_func;
  14080. +#endif
  14081. +#ifdef __cplusplus
  14082. +}
  14083.  #endif
  14084.  
  14085. -; return 0; }
  14086. -EOF
  14087. -if { (eval echo configure:3266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  14088. -  rm -rf conftest*
  14089. -  eval "ac_cv_func_$ac_func=yes"
  14090. -else
  14091. -  echo "configure: failed program was:" >&5
  14092. -  cat conftest.$ac_ext >&5
  14093. -  rm -rf conftest*
  14094. -  eval "ac_cv_func_$ac_func=no"
  14095. -fi
  14096. -rm -f conftest*
  14097. -fi
  14098. +int
  14099. +main ()
  14100. +{
  14101. +return f != $ac_func;
  14102. +  ;
  14103. +  return 0;
  14104. +}
  14105. +_ACEOF
  14106. +rm -f conftest.$ac_objext conftest$ac_exeext
  14107. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  14108. +  (eval $ac_link) 2>&5
  14109. +  ac_status=$?
  14110. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14111. +  (exit $ac_status); } &&
  14112. +         { ac_try='test -s conftest$ac_exeext'
  14113. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  14114. +  (eval $ac_try) 2>&5
  14115. +  ac_status=$?
  14116. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14117. +  (exit $ac_status); }; }; then
  14118. +  eval "$as_ac_var=yes"
  14119. +else
  14120. +  echo "$as_me: failed program was:" >&5
  14121. +sed 's/^/| /' conftest.$ac_ext >&5
  14122. +
  14123. +eval "$as_ac_var=no"
  14124. +fi
  14125. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  14126. +fi
  14127. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  14128. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  14129. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  14130.  
  14131. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  14132. -  echo "$ac_t""yes" 1>&6
  14133. -  cat >> confdefs.h <<EOF
  14134. +cat >>confdefs.h <<_ACEOF
  14135.  #define CRAY_STACKSEG_END $ac_func
  14136. -EOF
  14137. +_ACEOF
  14138.  
  14139.    break
  14140. -else
  14141. -  echo "$ac_t""no" 1>&6
  14142.  fi
  14143.  
  14144. -done
  14145. +  done
  14146.  fi
  14147.  
  14148. -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
  14149. -echo "configure:3293: checking stack direction for C alloca" >&5
  14150. -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
  14151. -  echo $ac_n "(cached) $ac_c" 1>&6
  14152. +echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
  14153. +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6
  14154. +if test "${ac_cv_c_stack_direction+set}" = set; then
  14155. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14156.  else
  14157.    if test "$cross_compiling" = yes; then
  14158.    ac_cv_c_stack_direction=0
  14159.  else
  14160. -  cat > conftest.$ac_ext <<EOF
  14161. -#line 3301 "configure"
  14162. -#include "confdefs.h"
  14163. +  cat >conftest.$ac_ext <<_ACEOF
  14164. +#line $LINENO "configure"
  14165. +/* confdefs.h.  */
  14166. +_ACEOF
  14167. +cat confdefs.h >>conftest.$ac_ext
  14168. +cat >>conftest.$ac_ext <<_ACEOF
  14169. +/* end confdefs.h.  */
  14170. +int
  14171.  find_stack_direction ()
  14172.  {
  14173.    static char *addr = 0;
  14174. @@ -3311,138 +5889,291 @@
  14175.    else
  14176.      return (&dummy > addr) ? 1 : -1;
  14177.  }
  14178. +
  14179. +int
  14180.  main ()
  14181.  {
  14182. -  exit (find_stack_direction() < 0);
  14183. -}
  14184. -EOF
  14185. -if { (eval echo configure:3320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  14186. -then
  14187. +  exit (find_stack_direction () < 0);
  14188. +}
  14189. +_ACEOF
  14190. +rm -f conftest$ac_exeext
  14191. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  14192. +  (eval $ac_link) 2>&5
  14193. +  ac_status=$?
  14194. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14195. +  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  14196. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  14197. +  (eval $ac_try) 2>&5
  14198. +  ac_status=$?
  14199. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14200. +  (exit $ac_status); }; }; then
  14201.    ac_cv_c_stack_direction=1
  14202.  else
  14203. -  echo "configure: failed program was:" >&5
  14204. -  cat conftest.$ac_ext >&5
  14205. -  rm -fr conftest*
  14206. -  ac_cv_c_stack_direction=-1
  14207. +  echo "$as_me: program exited with status $ac_status" >&5
  14208. +echo "$as_me: failed program was:" >&5
  14209. +sed 's/^/| /' conftest.$ac_ext >&5
  14210. +
  14211. +( exit $ac_status )
  14212. +ac_cv_c_stack_direction=-1
  14213.  fi
  14214. -rm -fr conftest*
  14215. +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
  14216.  fi
  14217. -
  14218.  fi
  14219. +echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
  14220. +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6
  14221.  
  14222. -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
  14223. -cat >> confdefs.h <<EOF
  14224. +cat >>confdefs.h <<_ACEOF
  14225.  #define STACK_DIRECTION $ac_cv_c_stack_direction
  14226. -EOF
  14227. +_ACEOF
  14228. +
  14229.  
  14230.  fi
  14231.  
  14232. -for ac_hdr in unistd.h
  14233. +
  14234. +
  14235. +for ac_header in stdlib.h unistd.h
  14236.  do
  14237. -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  14238. -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
  14239. -echo "configure:3345: checking for $ac_hdr" >&5
  14240. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  14241. -  echo $ac_n "(cached) $ac_c" 1>&6
  14242. -else
  14243. -  cat > conftest.$ac_ext <<EOF
  14244. -#line 3350 "configure"
  14245. -#include "confdefs.h"
  14246. -#include <$ac_hdr>
  14247. -EOF
  14248. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  14249. -{ (eval echo configure:3355: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  14250. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  14251. -if test -z "$ac_err"; then
  14252. -  rm -rf conftest*
  14253. -  eval "ac_cv_header_$ac_safe=yes"
  14254. +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  14255. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  14256. +  echo "$as_me:$LINENO: checking for $ac_header" >&5
  14257. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  14258. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  14259. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14260. +fi
  14261. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  14262. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  14263. +else
  14264. +  # Is the header compilable?
  14265. +echo "$as_me:$LINENO: checking $ac_header usability" >&5
  14266. +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
  14267. +cat >conftest.$ac_ext <<_ACEOF
  14268. +#line $LINENO "configure"
  14269. +/* confdefs.h.  */
  14270. +_ACEOF
  14271. +cat confdefs.h >>conftest.$ac_ext
  14272. +cat >>conftest.$ac_ext <<_ACEOF
  14273. +/* end confdefs.h.  */
  14274. +$ac_includes_default
  14275. +#include <$ac_header>
  14276. +_ACEOF
  14277. +rm -f conftest.$ac_objext
  14278. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  14279. +  (eval $ac_compile) 2>&5
  14280. +  ac_status=$?
  14281. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14282. +  (exit $ac_status); } &&
  14283. +         { ac_try='test -s conftest.$ac_objext'
  14284. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  14285. +  (eval $ac_try) 2>&5
  14286. +  ac_status=$?
  14287. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14288. +  (exit $ac_status); }; }; then
  14289. +  ac_header_compiler=yes
  14290. +else
  14291. +  echo "$as_me: failed program was:" >&5
  14292. +sed 's/^/| /' conftest.$ac_ext >&5
  14293. +
  14294. +ac_header_compiler=no
  14295. +fi
  14296. +rm -f conftest.$ac_objext conftest.$ac_ext
  14297. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  14298. +echo "${ECHO_T}$ac_header_compiler" >&6
  14299. +
  14300. +# Is the header present?
  14301. +echo "$as_me:$LINENO: checking $ac_header presence" >&5
  14302. +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
  14303. +cat >conftest.$ac_ext <<_ACEOF
  14304. +#line $LINENO "configure"
  14305. +/* confdefs.h.  */
  14306. +_ACEOF
  14307. +cat confdefs.h >>conftest.$ac_ext
  14308. +cat >>conftest.$ac_ext <<_ACEOF
  14309. +/* end confdefs.h.  */
  14310. +#include <$ac_header>
  14311. +_ACEOF
  14312. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  14313. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  14314. +  ac_status=$?
  14315. +  grep -v '^ *+' conftest.er1 >conftest.err
  14316. +  rm -f conftest.er1
  14317. +  cat conftest.err >&5
  14318. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14319. +  (exit $ac_status); } >/dev/null; then
  14320. +  if test -s conftest.err; then
  14321. +    ac_cpp_err=$ac_c_preproc_warn_flag
  14322. +  else
  14323. +    ac_cpp_err=
  14324. +  fi
  14325. +else
  14326. +  ac_cpp_err=yes
  14327. +fi
  14328. +if test -z "$ac_cpp_err"; then
  14329. +  ac_header_preproc=yes
  14330. +else
  14331. +  echo "$as_me: failed program was:" >&5
  14332. +sed 's/^/| /' conftest.$ac_ext >&5
  14333. +
  14334. +  ac_header_preproc=no
  14335. +fi
  14336. +rm -f conftest.err conftest.$ac_ext
  14337. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  14338. +echo "${ECHO_T}$ac_header_preproc" >&6
  14339. +
  14340. +# So?  What about this header?
  14341. +case $ac_header_compiler:$ac_header_preproc in
  14342. +  yes:no )
  14343. +    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
  14344. +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
  14345. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  14346. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  14347. +    (
  14348. +      cat <<\_ASBOX
  14349. +## ------------------------------------ ##
  14350. +## Report this to bug-autoconf@gnu.org. ##
  14351. +## ------------------------------------ ##
  14352. +_ASBOX
  14353. +    ) |
  14354. +      sed "s/^/$as_me: WARNING:     /" >&2
  14355. +    ;;
  14356. +  no:yes )
  14357. +    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
  14358. +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
  14359. +    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
  14360. +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
  14361. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  14362. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  14363. +    (
  14364. +      cat <<\_ASBOX
  14365. +## ------------------------------------ ##
  14366. +## Report this to bug-autoconf@gnu.org. ##
  14367. +## ------------------------------------ ##
  14368. +_ASBOX
  14369. +    ) |
  14370. +      sed "s/^/$as_me: WARNING:     /" >&2
  14371. +    ;;
  14372. +esac
  14373. +echo "$as_me:$LINENO: checking for $ac_header" >&5
  14374. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  14375. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  14376. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14377.  else
  14378. -  echo "$ac_err" >&5
  14379. -  echo "configure: failed program was:" >&5
  14380. -  cat conftest.$ac_ext >&5
  14381. -  rm -rf conftest*
  14382. -  eval "ac_cv_header_$ac_safe=no"
  14383. +  eval "$as_ac_Header=$ac_header_preproc"
  14384.  fi
  14385. -rm -f conftest*
  14386. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  14387. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  14388. +
  14389.  fi
  14390. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  14391. -  echo "$ac_t""yes" 1>&6
  14392. -    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  14393. -  cat >> confdefs.h <<EOF
  14394. -#define $ac_tr_hdr 1
  14395. -EOF
  14396. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  14397. +  cat >>confdefs.h <<_ACEOF
  14398. +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  14399. +_ACEOF
  14400.   
  14401. -else
  14402. -  echo "$ac_t""no" 1>&6
  14403.  fi
  14404. +
  14405.  done
  14406.  
  14407. +
  14408.  for ac_func in getpagesize
  14409.  do
  14410. -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  14411. -echo "configure:3384: checking for $ac_func" >&5
  14412. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  14413. -  echo $ac_n "(cached) $ac_c" 1>&6
  14414. -else
  14415. -  cat > conftest.$ac_ext <<EOF
  14416. -#line 3389 "configure"
  14417. -#include "confdefs.h"
  14418. +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  14419. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  14420. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  14421. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  14422. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14423. +else
  14424. +  cat >conftest.$ac_ext <<_ACEOF
  14425. +#line $LINENO "configure"
  14426. +/* confdefs.h.  */
  14427. +_ACEOF
  14428. +cat confdefs.h >>conftest.$ac_ext
  14429. +cat >>conftest.$ac_ext <<_ACEOF
  14430. +/* end confdefs.h.  */
  14431.  /* System header to define __stub macros and hopefully few prototypes,
  14432. -    which can conflict with char $ac_func(); below.  */
  14433. -#include <assert.h>
  14434. +    which can conflict with char $ac_func (); below.
  14435. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  14436. +    <limits.h> exists even on freestanding compilers.  */
  14437. +#ifdef __STDC__
  14438. +# include <limits.h>
  14439. +#else
  14440. +# include <assert.h>
  14441. +#endif
  14442.  /* Override any gcc2 internal prototype to avoid an error.  */
  14443. +#ifdef __cplusplus
  14444. +extern "C"
  14445. +{
  14446. +#endif
  14447.  /* We use char because int might match the return type of a gcc2
  14448.      builtin and then its argument prototype would still apply.  */
  14449. -char $ac_func();
  14450. -
  14451. -int main() {
  14452. -
  14453. +char $ac_func ();
  14454.  /* The GNU C library defines this for functions which it implements
  14455.      to always fail with ENOSYS.  Some functions are actually named
  14456.      something starting with __ and the normal name is an alias.  */
  14457.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  14458.  choke me
  14459.  #else
  14460. -$ac_func();
  14461. +char (*f) () = $ac_func;
  14462. +#endif
  14463. +#ifdef __cplusplus
  14464. +}
  14465.  #endif
  14466.  
  14467. -; return 0; }
  14468. -EOF
  14469. -if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  14470. -  rm -rf conftest*
  14471. -  eval "ac_cv_func_$ac_func=yes"
  14472. -else
  14473. -  echo "configure: failed program was:" >&5
  14474. -  cat conftest.$ac_ext >&5
  14475. -  rm -rf conftest*
  14476. -  eval "ac_cv_func_$ac_func=no"
  14477. -fi
  14478. -rm -f conftest*
  14479. -fi
  14480. -
  14481. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  14482. -  echo "$ac_t""yes" 1>&6
  14483. -    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  14484. -  cat >> confdefs.h <<EOF
  14485. -#define $ac_tr_func 1
  14486. -EOF
  14487. +int
  14488. +main ()
  14489. +{
  14490. +return f != $ac_func;
  14491. +  ;
  14492. +  return 0;
  14493. +}
  14494. +_ACEOF
  14495. +rm -f conftest.$ac_objext conftest$ac_exeext
  14496. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  14497. +  (eval $ac_link) 2>&5
  14498. +  ac_status=$?
  14499. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14500. +  (exit $ac_status); } &&
  14501. +         { ac_try='test -s conftest$ac_exeext'
  14502. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  14503. +  (eval $ac_try) 2>&5
  14504. +  ac_status=$?
  14505. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14506. +  (exit $ac_status); }; }; then
  14507. +  eval "$as_ac_var=yes"
  14508. +else
  14509. +  echo "$as_me: failed program was:" >&5
  14510. +sed 's/^/| /' conftest.$ac_ext >&5
  14511. +
  14512. +eval "$as_ac_var=no"
  14513. +fi
  14514. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  14515. +fi
  14516. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  14517. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  14518. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  14519. +  cat >>confdefs.h <<_ACEOF
  14520. +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  14521. +_ACEOF
  14522.   
  14523. -else
  14524. -  echo "$ac_t""no" 1>&6
  14525.  fi
  14526.  done
  14527.  
  14528. -echo $ac_n "checking for working mmap""... $ac_c" 1>&6
  14529. -echo "configure:3437: checking for working mmap" >&5
  14530. -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
  14531. -  echo $ac_n "(cached) $ac_c" 1>&6
  14532. +echo "$as_me:$LINENO: checking for working mmap" >&5
  14533. +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
  14534. +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
  14535. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14536.  else
  14537.    if test "$cross_compiling" = yes; then
  14538.    ac_cv_func_mmap_fixed_mapped=no
  14539.  else
  14540. -  cat > conftest.$ac_ext <<EOF
  14541. -#line 3445 "configure"
  14542. -#include "confdefs.h"
  14543. +  cat >conftest.$ac_ext <<_ACEOF
  14544. +#line $LINENO "configure"
  14545. +/* confdefs.h.  */
  14546. +_ACEOF
  14547. +cat confdefs.h >>conftest.$ac_ext
  14548. +cat >>conftest.$ac_ext <<_ACEOF
  14549. +/* end confdefs.h.  */
  14550. +$ac_includes_default
  14551. +/* malloc might have been renamed as rpl_malloc. */
  14552. +#undef malloc
  14553.  
  14554.  /* Thanks to Mike Haertel and Jim Avera for this test.
  14555.     Here is a matrix of mmap possibilities:
  14556. @@ -3456,34 +6187,34 @@
  14557.     back from the file, nor mmap's back from the file at a different
  14558.     address.  (There have been systems where private was not correctly
  14559.     implemented like the infamous i386 svr4.0, and systems where the
  14560. -   VM page cache was not coherent with the filesystem buffer cache
  14561. +   VM page cache was not coherent with the file system buffer cache
  14562.     like early versions of FreeBSD and possibly contemporary NetBSD.)
  14563.     For shared mappings, we should conversely verify that changes get
  14564. -   propogated back to all the places they're supposed to be.
  14565. +   propagated back to all the places they're supposed to be.
  14566.  
  14567.     Grep wants private fixed already mapped.
  14568.     The main things grep needs to know about mmap are:
  14569.     * does it exist and is it safe to write into the mmap'd area
  14570.     * how to use it (BSD variants)  */
  14571. -#include <sys/types.h>
  14572. +
  14573.  #include <fcntl.h>
  14574.  #include <sys/mman.h>
  14575.  
  14576. -/* This mess was copied from the GNU getpagesize.h.  */
  14577. -#ifndef HAVE_GETPAGESIZE
  14578. -# ifdef HAVE_UNISTD_H
  14579. -#  include <unistd.h>
  14580. -# endif
  14581. +#if !STDC_HEADERS && !HAVE_STDLIB_H
  14582. +char *malloc ();
  14583. +#endif
  14584.  
  14585. +/* This mess was copied from the GNU getpagesize.h.  */
  14586. +#if !HAVE_GETPAGESIZE
  14587.  /* Assume that all systems that can run configure have sys/param.h.  */
  14588. -# ifndef HAVE_SYS_PARAM_H
  14589. +# if !HAVE_SYS_PARAM_H
  14590.  #  define HAVE_SYS_PARAM_H 1
  14591.  # endif
  14592.  
  14593.  # ifdef _SC_PAGESIZE
  14594.  #  define getpagesize() sysconf(_SC_PAGESIZE)
  14595.  # else /* no _SC_PAGESIZE */
  14596. -#  ifdef HAVE_SYS_PARAM_H
  14597. +#  if HAVE_SYS_PARAM_H
  14598.  #   include <sys/param.h>
  14599.  #   ifdef EXEC_PAGESIZE
  14600.  #    define getpagesize() EXEC_PAGESIZE
  14601. @@ -3510,327 +6241,524 @@
  14602.  
  14603.  #endif /* no HAVE_GETPAGESIZE */
  14604.  
  14605. -#ifdef __cplusplus
  14606. -extern "C" { void *malloc(unsigned); }
  14607. -#else
  14608. -char *malloc();
  14609. -#endif
  14610. -
  14611.  int
  14612. -main()
  14613. +main ()
  14614.  {
  14615.      char *data, *data2, *data3;
  14616.      int i, pagesize;
  14617.      int fd;
  14618.  
  14619. -    pagesize = getpagesize();
  14620. +  pagesize = getpagesize ();
  14621.  
  14622. -    /*
  14623. -     * First, make a file with some known garbage in it.
  14624. -     */
  14625. -    data = malloc(pagesize);
  14626. +  /* First, make a file with some known garbage in it. */
  14627. +  data = (char *) malloc (pagesize);
  14628.      if (!data)
  14629. -        exit(1);
  14630. +    exit (1);
  14631.      for (i = 0; i < pagesize; ++i)
  14632. -        *(data + i) = rand();
  14633. -    umask(0);
  14634. -    fd = creat("conftestmmap", 0600);
  14635. +    *(data + i) = rand ();
  14636. +  umask (0);
  14637. +  fd = creat ("conftest.mmap", 0600);
  14638.      if (fd < 0)
  14639. -        exit(1);
  14640. -    if (write(fd, data, pagesize) != pagesize)
  14641. -        exit(1);
  14642. -    close(fd);
  14643. -
  14644. -    /*
  14645. -     * Next, try to mmap the file at a fixed address which
  14646. -     * already has something else allocated at it.  If we can,
  14647. -     * also make sure that we see the same garbage.
  14648. -     */
  14649. -    fd = open("conftestmmap", O_RDWR);
  14650. +    exit (1);
  14651. +  if (write (fd, data, pagesize) != pagesize)
  14652. +    exit (1);
  14653. +  close (fd);
  14654. +
  14655. +  /* Next, try to mmap the file at a fixed address which already has
  14656. +     something else allocated at it.  If we can, also make sure that
  14657. +     we see the same garbage.  */
  14658. +  fd = open ("conftest.mmap", O_RDWR);
  14659.      if (fd < 0)
  14660. -        exit(1);
  14661. -    data2 = malloc(2 * pagesize);
  14662. +    exit (1);
  14663. +  data2 = (char *) malloc (2 * pagesize);
  14664.      if (!data2)
  14665. -        exit(1);
  14666. +    exit (1);
  14667.      data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
  14668. -    if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
  14669. +  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
  14670.          MAP_PRIVATE | MAP_FIXED, fd, 0L))
  14671. -        exit(1);
  14672. +    exit (1);
  14673.      for (i = 0; i < pagesize; ++i)
  14674.          if (*(data + i) != *(data2 + i))
  14675. -            exit(1);
  14676. +      exit (1);
  14677.  
  14678. -    /*
  14679. -     * Finally, make sure that changes to the mapped area
  14680. -     * do not percolate back to the file as seen by read().
  14681. -     * (This is a bug on some variants of i386 svr4.0.)
  14682. -     */
  14683. +  /* Finally, make sure that changes to the mapped area do not
  14684. +     percolate back to the file as seen by read().  (This is a bug on
  14685. +     some variants of i386 svr4.0.)  */
  14686.      for (i = 0; i < pagesize; ++i)
  14687.          *(data2 + i) = *(data2 + i) + 1;
  14688. -    data3 = malloc(pagesize);
  14689. +  data3 = (char *) malloc (pagesize);
  14690.      if (!data3)
  14691. -        exit(1);
  14692. -    if (read(fd, data3, pagesize) != pagesize)
  14693. -        exit(1);
  14694. +    exit (1);
  14695. +  if (read (fd, data3, pagesize) != pagesize)
  14696. +    exit (1);
  14697.      for (i = 0; i < pagesize; ++i)
  14698.          if (*(data + i) != *(data3 + i))
  14699. -            exit(1);
  14700. -    close(fd);
  14701. -    unlink("conftestmmap");
  14702. -    exit(0);
  14703. +      exit (1);
  14704. +  close (fd);
  14705. +  exit (0);
  14706.  }
  14707. -
  14708. -EOF
  14709. -if { (eval echo configure:3585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  14710. -then
  14711. +_ACEOF
  14712. +rm -f conftest$ac_exeext
  14713. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  14714. +  (eval $ac_link) 2>&5
  14715. +  ac_status=$?
  14716. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14717. +  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  14718. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  14719. +  (eval $ac_try) 2>&5
  14720. +  ac_status=$?
  14721. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14722. +  (exit $ac_status); }; }; then
  14723.    ac_cv_func_mmap_fixed_mapped=yes
  14724.  else
  14725. -  echo "configure: failed program was:" >&5
  14726. -  cat conftest.$ac_ext >&5
  14727. -  rm -fr conftest*
  14728. -  ac_cv_func_mmap_fixed_mapped=no
  14729. +  echo "$as_me: program exited with status $ac_status" >&5
  14730. +echo "$as_me: failed program was:" >&5
  14731. +sed 's/^/| /' conftest.$ac_ext >&5
  14732. +
  14733. +( exit $ac_status )
  14734. +ac_cv_func_mmap_fixed_mapped=no
  14735.  fi
  14736. -rm -fr conftest*
  14737. +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
  14738.  fi
  14739. -
  14740.  fi
  14741. -
  14742. -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
  14743. +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
  14744. +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
  14745.  if test $ac_cv_func_mmap_fixed_mapped = yes; then
  14746. -  cat >> confdefs.h <<\EOF
  14747. +
  14748. +cat >>confdefs.h <<\_ACEOF
  14749.  #define HAVE_MMAP 1
  14750. -EOF
  14751. +_ACEOF
  14752.  
  14753.  fi
  14754. +rm -f conftest.mmap
  14755.  
  14756.                                
  14757. -   for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
  14758. +
  14759. +                              
  14760. +
  14761. +
  14762. +
  14763. +
  14764. +
  14765. +
  14766. +
  14767. +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \
  14768.  unistd.h values.h sys/param.h
  14769.  do
  14770. -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  14771. -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
  14772. -echo "configure:3613: checking for $ac_hdr" >&5
  14773. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  14774. -  echo $ac_n "(cached) $ac_c" 1>&6
  14775. -else
  14776. -  cat > conftest.$ac_ext <<EOF
  14777. -#line 3618 "configure"
  14778. -#include "confdefs.h"
  14779. -#include <$ac_hdr>
  14780. -EOF
  14781. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  14782. -{ (eval echo configure:3623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  14783. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  14784. -if test -z "$ac_err"; then
  14785. -  rm -rf conftest*
  14786. -  eval "ac_cv_header_$ac_safe=yes"
  14787. +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  14788. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  14789. +  echo "$as_me:$LINENO: checking for $ac_header" >&5
  14790. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  14791. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  14792. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14793. +fi
  14794. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  14795. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  14796. +else
  14797. +  # Is the header compilable?
  14798. +echo "$as_me:$LINENO: checking $ac_header usability" >&5
  14799. +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
  14800. +cat >conftest.$ac_ext <<_ACEOF
  14801. +#line $LINENO "configure"
  14802. +/* confdefs.h.  */
  14803. +_ACEOF
  14804. +cat confdefs.h >>conftest.$ac_ext
  14805. +cat >>conftest.$ac_ext <<_ACEOF
  14806. +/* end confdefs.h.  */
  14807. +$ac_includes_default
  14808. +#include <$ac_header>
  14809. +_ACEOF
  14810. +rm -f conftest.$ac_objext
  14811. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  14812. +  (eval $ac_compile) 2>&5
  14813. +  ac_status=$?
  14814. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14815. +  (exit $ac_status); } &&
  14816. +         { ac_try='test -s conftest.$ac_objext'
  14817. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  14818. +  (eval $ac_try) 2>&5
  14819. +  ac_status=$?
  14820. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14821. +  (exit $ac_status); }; }; then
  14822. +  ac_header_compiler=yes
  14823. +else
  14824. +  echo "$as_me: failed program was:" >&5
  14825. +sed 's/^/| /' conftest.$ac_ext >&5
  14826. +
  14827. +ac_header_compiler=no
  14828. +fi
  14829. +rm -f conftest.$ac_objext conftest.$ac_ext
  14830. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  14831. +echo "${ECHO_T}$ac_header_compiler" >&6
  14832. +
  14833. +# Is the header present?
  14834. +echo "$as_me:$LINENO: checking $ac_header presence" >&5
  14835. +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
  14836. +cat >conftest.$ac_ext <<_ACEOF
  14837. +#line $LINENO "configure"
  14838. +/* confdefs.h.  */
  14839. +_ACEOF
  14840. +cat confdefs.h >>conftest.$ac_ext
  14841. +cat >>conftest.$ac_ext <<_ACEOF
  14842. +/* end confdefs.h.  */
  14843. +#include <$ac_header>
  14844. +_ACEOF
  14845. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  14846. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  14847. +  ac_status=$?
  14848. +  grep -v '^ *+' conftest.er1 >conftest.err
  14849. +  rm -f conftest.er1
  14850. +  cat conftest.err >&5
  14851. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  14852. +  (exit $ac_status); } >/dev/null; then
  14853. +  if test -s conftest.err; then
  14854. +    ac_cpp_err=$ac_c_preproc_warn_flag
  14855. +  else
  14856. +    ac_cpp_err=
  14857. +  fi
  14858. +else
  14859. +  ac_cpp_err=yes
  14860. +fi
  14861. +if test -z "$ac_cpp_err"; then
  14862. +  ac_header_preproc=yes
  14863. +else
  14864. +  echo "$as_me: failed program was:" >&5
  14865. +sed 's/^/| /' conftest.$ac_ext >&5
  14866. +
  14867. +  ac_header_preproc=no
  14868. +fi
  14869. +rm -f conftest.err conftest.$ac_ext
  14870. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  14871. +echo "${ECHO_T}$ac_header_preproc" >&6
  14872. +
  14873. +# So?  What about this header?
  14874. +case $ac_header_compiler:$ac_header_preproc in
  14875. +  yes:no )
  14876. +    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
  14877. +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
  14878. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  14879. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  14880. +    (
  14881. +      cat <<\_ASBOX
  14882. +## ------------------------------------ ##
  14883. +## Report this to bug-autoconf@gnu.org. ##
  14884. +## ------------------------------------ ##
  14885. +_ASBOX
  14886. +    ) |
  14887. +      sed "s/^/$as_me: WARNING:     /" >&2
  14888. +    ;;
  14889. +  no:yes )
  14890. +    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
  14891. +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
  14892. +    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
  14893. +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
  14894. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  14895. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  14896. +    (
  14897. +      cat <<\_ASBOX
  14898. +## ------------------------------------ ##
  14899. +## Report this to bug-autoconf@gnu.org. ##
  14900. +## ------------------------------------ ##
  14901. +_ASBOX
  14902. +    ) |
  14903. +      sed "s/^/$as_me: WARNING:     /" >&2
  14904. +    ;;
  14905. +esac
  14906. +echo "$as_me:$LINENO: checking for $ac_header" >&5
  14907. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  14908. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  14909. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14910.  else
  14911. -  echo "$ac_err" >&5
  14912. -  echo "configure: failed program was:" >&5
  14913. -  cat conftest.$ac_ext >&5
  14914. -  rm -rf conftest*
  14915. -  eval "ac_cv_header_$ac_safe=no"
  14916. +  eval "$as_ac_Header=$ac_header_preproc"
  14917.  fi
  14918. -rm -f conftest*
  14919. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  14920. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  14921. +
  14922.  fi
  14923. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  14924. -  echo "$ac_t""yes" 1>&6
  14925. -    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  14926. -  cat >> confdefs.h <<EOF
  14927. -#define $ac_tr_hdr 1
  14928. -EOF
  14929. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  14930. +  cat >>confdefs.h <<_ACEOF
  14931. +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  14932. +_ACEOF
  14933.   
  14934. -else
  14935. -  echo "$ac_t""no" 1>&6
  14936.  fi
  14937. +
  14938.  done
  14939.  
  14940. -   for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
  14941. +
  14942. +
  14943. +
  14944. +
  14945. +
  14946. +
  14947. +
  14948. +
  14949. +
  14950. +
  14951. +for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
  14952.  __argz_count __argz_stringify __argz_next
  14953.  do
  14954. -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  14955. -echo "configure:3653: checking for $ac_func" >&5
  14956. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  14957. -  echo $ac_n "(cached) $ac_c" 1>&6
  14958. -else
  14959. -  cat > conftest.$ac_ext <<EOF
  14960. -#line 3658 "configure"
  14961. -#include "confdefs.h"
  14962. +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  14963. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  14964. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  14965. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  14966. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  14967. +else
  14968. +  cat >conftest.$ac_ext <<_ACEOF
  14969. +#line $LINENO "configure"
  14970. +/* confdefs.h.  */
  14971. +_ACEOF
  14972. +cat confdefs.h >>conftest.$ac_ext
  14973. +cat >>conftest.$ac_ext <<_ACEOF
  14974. +/* end confdefs.h.  */
  14975.  /* System header to define __stub macros and hopefully few prototypes,
  14976. -    which can conflict with char $ac_func(); below.  */
  14977. -#include <assert.h>
  14978. +    which can conflict with char $ac_func (); below.
  14979. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  14980. +    <limits.h> exists even on freestanding compilers.  */
  14981. +#ifdef __STDC__
  14982. +# include <limits.h>
  14983. +#else
  14984. +# include <assert.h>
  14985. +#endif
  14986.  /* Override any gcc2 internal prototype to avoid an error.  */
  14987. +#ifdef __cplusplus
  14988. +extern "C"
  14989. +{
  14990. +#endif
  14991.  /* We use char because int might match the return type of a gcc2
  14992.      builtin and then its argument prototype would still apply.  */
  14993. -char $ac_func();
  14994. -
  14995. -int main() {
  14996. -
  14997. +char $ac_func ();
  14998.  /* The GNU C library defines this for functions which it implements
  14999.      to always fail with ENOSYS.  Some functions are actually named
  15000.      something starting with __ and the normal name is an alias.  */
  15001.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  15002.  choke me
  15003.  #else
  15004. -$ac_func();
  15005. +char (*f) () = $ac_func;
  15006. +#endif
  15007. +#ifdef __cplusplus
  15008. +}
  15009.  #endif
  15010.  
  15011. -; return 0; }
  15012. -EOF
  15013. -if { (eval echo configure:3681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15014. -  rm -rf conftest*
  15015. -  eval "ac_cv_func_$ac_func=yes"
  15016. -else
  15017. -  echo "configure: failed program was:" >&5
  15018. -  cat conftest.$ac_ext >&5
  15019. -  rm -rf conftest*
  15020. -  eval "ac_cv_func_$ac_func=no"
  15021. -fi
  15022. -rm -f conftest*
  15023. -fi
  15024. -
  15025. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  15026. -  echo "$ac_t""yes" 1>&6
  15027. -    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  15028. -  cat >> confdefs.h <<EOF
  15029. -#define $ac_tr_func 1
  15030. -EOF
  15031. +int
  15032. +main ()
  15033. +{
  15034. +return f != $ac_func;
  15035. +  ;
  15036. +  return 0;
  15037. +}
  15038. +_ACEOF
  15039. +rm -f conftest.$ac_objext conftest$ac_exeext
  15040. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15041. +  (eval $ac_link) 2>&5
  15042. +  ac_status=$?
  15043. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15044. +  (exit $ac_status); } &&
  15045. +         { ac_try='test -s conftest$ac_exeext'
  15046. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15047. +  (eval $ac_try) 2>&5
  15048. +  ac_status=$?
  15049. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15050. +  (exit $ac_status); }; }; then
  15051. +  eval "$as_ac_var=yes"
  15052. +else
  15053. +  echo "$as_me: failed program was:" >&5
  15054. +sed 's/^/| /' conftest.$ac_ext >&5
  15055. +
  15056. +eval "$as_ac_var=no"
  15057. +fi
  15058. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  15059. +fi
  15060. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  15061. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  15062. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  15063. +  cat >>confdefs.h <<_ACEOF
  15064. +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  15065. +_ACEOF
  15066.   
  15067. -else
  15068. -  echo "$ac_t""no" 1>&6
  15069.  fi
  15070.  done
  15071.  
  15072.  
  15073.     if test "${ac_cv_func_stpcpy+set}" != "set"; then
  15074. -     for ac_func in stpcpy
  15075. +
  15076. +for ac_func in stpcpy
  15077.  do
  15078. -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  15079. -echo "configure:3710: checking for $ac_func" >&5
  15080. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  15081. -  echo $ac_n "(cached) $ac_c" 1>&6
  15082. -else
  15083. -  cat > conftest.$ac_ext <<EOF
  15084. -#line 3715 "configure"
  15085. -#include "confdefs.h"
  15086. +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  15087. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  15088. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  15089. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  15090. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15091. +else
  15092. +  cat >conftest.$ac_ext <<_ACEOF
  15093. +#line $LINENO "configure"
  15094. +/* confdefs.h.  */
  15095. +_ACEOF
  15096. +cat confdefs.h >>conftest.$ac_ext
  15097. +cat >>conftest.$ac_ext <<_ACEOF
  15098. +/* end confdefs.h.  */
  15099.  /* System header to define __stub macros and hopefully few prototypes,
  15100. -    which can conflict with char $ac_func(); below.  */
  15101. -#include <assert.h>
  15102. +    which can conflict with char $ac_func (); below.
  15103. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  15104. +    <limits.h> exists even on freestanding compilers.  */
  15105. +#ifdef __STDC__
  15106. +# include <limits.h>
  15107. +#else
  15108. +# include <assert.h>
  15109. +#endif
  15110.  /* Override any gcc2 internal prototype to avoid an error.  */
  15111. +#ifdef __cplusplus
  15112. +extern "C"
  15113. +{
  15114. +#endif
  15115.  /* We use char because int might match the return type of a gcc2
  15116.      builtin and then its argument prototype would still apply.  */
  15117. -char $ac_func();
  15118. -
  15119. -int main() {
  15120. -
  15121. +char $ac_func ();
  15122.  /* The GNU C library defines this for functions which it implements
  15123.      to always fail with ENOSYS.  Some functions are actually named
  15124.      something starting with __ and the normal name is an alias.  */
  15125.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  15126.  choke me
  15127.  #else
  15128. -$ac_func();
  15129. +char (*f) () = $ac_func;
  15130. +#endif
  15131. +#ifdef __cplusplus
  15132. +}
  15133.  #endif
  15134.  
  15135. -; return 0; }
  15136. -EOF
  15137. -if { (eval echo configure:3738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15138. -  rm -rf conftest*
  15139. -  eval "ac_cv_func_$ac_func=yes"
  15140. -else
  15141. -  echo "configure: failed program was:" >&5
  15142. -  cat conftest.$ac_ext >&5
  15143. -  rm -rf conftest*
  15144. -  eval "ac_cv_func_$ac_func=no"
  15145. -fi
  15146. -rm -f conftest*
  15147. -fi
  15148. -
  15149. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  15150. -  echo "$ac_t""yes" 1>&6
  15151. -    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  15152. -  cat >> confdefs.h <<EOF
  15153. -#define $ac_tr_func 1
  15154. -EOF
  15155. +int
  15156. +main ()
  15157. +{
  15158. +return f != $ac_func;
  15159. +  ;
  15160. +  return 0;
  15161. +}
  15162. +_ACEOF
  15163. +rm -f conftest.$ac_objext conftest$ac_exeext
  15164. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15165. +  (eval $ac_link) 2>&5
  15166. +  ac_status=$?
  15167. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15168. +  (exit $ac_status); } &&
  15169. +         { ac_try='test -s conftest$ac_exeext'
  15170. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15171. +  (eval $ac_try) 2>&5
  15172. +  ac_status=$?
  15173. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15174. +  (exit $ac_status); }; }; then
  15175. +  eval "$as_ac_var=yes"
  15176. +else
  15177. +  echo "$as_me: failed program was:" >&5
  15178. +sed 's/^/| /' conftest.$ac_ext >&5
  15179. +
  15180. +eval "$as_ac_var=no"
  15181. +fi
  15182. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  15183. +fi
  15184. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  15185. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  15186. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  15187. +  cat >>confdefs.h <<_ACEOF
  15188. +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  15189. +_ACEOF
  15190.   
  15191. -else
  15192. -  echo "$ac_t""no" 1>&6
  15193.  fi
  15194.  done
  15195.  
  15196.     fi
  15197.     if test "${ac_cv_func_stpcpy}" = "yes"; then
  15198. -     cat >> confdefs.h <<\EOF
  15199. +
  15200. +cat >>confdefs.h <<\_ACEOF
  15201.  #define HAVE_STPCPY 1
  15202. -EOF
  15203. +_ACEOF
  15204.  
  15205.     fi
  15206.  
  15207.     if test $ac_cv_header_locale_h = yes; then
  15208. -    echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
  15209. -echo "configure:3772: checking for LC_MESSAGES" >&5
  15210. -if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
  15211. -  echo $ac_n "(cached) $ac_c" 1>&6
  15212. -else
  15213. -  cat > conftest.$ac_ext <<EOF
  15214. -#line 3777 "configure"
  15215. -#include "confdefs.h"
  15216. +    echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5
  15217. +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6
  15218. +if test "${am_cv_val_LC_MESSAGES+set}" = set; then
  15219. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15220. +else
  15221. +  cat >conftest.$ac_ext <<_ACEOF
  15222. +#line $LINENO "configure"
  15223. +/* confdefs.h.  */
  15224. +_ACEOF
  15225. +cat confdefs.h >>conftest.$ac_ext
  15226. +cat >>conftest.$ac_ext <<_ACEOF
  15227. +/* end confdefs.h.  */
  15228.  #include <locale.h>
  15229. -int main() {
  15230. +int
  15231. +main ()
  15232. +{
  15233.  return LC_MESSAGES
  15234. -; return 0; }
  15235. -EOF
  15236. -if { (eval echo configure:3784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15237. -  rm -rf conftest*
  15238. +  ;
  15239. +  return 0;
  15240. +}
  15241. +_ACEOF
  15242. +rm -f conftest.$ac_objext conftest$ac_exeext
  15243. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15244. +  (eval $ac_link) 2>&5
  15245. +  ac_status=$?
  15246. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15247. +  (exit $ac_status); } &&
  15248. +         { ac_try='test -s conftest$ac_exeext'
  15249. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15250. +  (eval $ac_try) 2>&5
  15251. +  ac_status=$?
  15252. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15253. +  (exit $ac_status); }; }; then
  15254.    am_cv_val_LC_MESSAGES=yes
  15255.  else
  15256. -  echo "configure: failed program was:" >&5
  15257. -  cat conftest.$ac_ext >&5
  15258. -  rm -rf conftest*
  15259. -  am_cv_val_LC_MESSAGES=no
  15260. +  echo "$as_me: failed program was:" >&5
  15261. +sed 's/^/| /' conftest.$ac_ext >&5
  15262. +
  15263. +am_cv_val_LC_MESSAGES=no
  15264.  fi
  15265. -rm -f conftest*
  15266. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  15267.  fi
  15268. -
  15269. -echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
  15270. +echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5
  15271. +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6
  15272.      if test $am_cv_val_LC_MESSAGES = yes; then
  15273. -      cat >> confdefs.h <<\EOF
  15274. +
  15275. +cat >>confdefs.h <<\_ACEOF
  15276.  #define HAVE_LC_MESSAGES 1
  15277. -EOF
  15278. +_ACEOF
  15279.  
  15280.      fi
  15281.    fi
  15282. -   echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
  15283. -echo "configure:3805: checking whether NLS is requested" >&5
  15284. +   echo "$as_me:$LINENO: checking whether NLS is requested" >&5
  15285. +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
  15286.          # Check whether --enable-nls or --disable-nls was given.
  15287.  if test "${enable_nls+set}" = set; then
  15288.    enableval="$enable_nls"
  15289.    USE_NLS=$enableval
  15290.  else
  15291.    USE_NLS=yes
  15292. -fi
  15293. -
  15294. -    echo "$ac_t""$USE_NLS" 1>&6
  15295. +fi;
  15296. +    echo "$as_me:$LINENO: result: $USE_NLS" >&5
  15297. +echo "${ECHO_T}$USE_NLS" >&6
  15298.      
  15299.  
  15300.      USE_INCLUDED_LIBINTL=no
  15301.  
  15302.          if test "$USE_NLS" = "yes"; then
  15303. -      cat >> confdefs.h <<\EOF
  15304. +
  15305. +cat >>confdefs.h <<\_ACEOF
  15306.  #define ENABLE_NLS 1
  15307. -EOF
  15308. +_ACEOF
  15309. +
  15310. +      echo "$as_me:$LINENO: checking whether included gettext is requested" >&5
  15311. +echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6
  15312.  
  15313. -      echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
  15314. -echo "configure:3825: checking whether included gettext is requested" >&5
  15315. -      # Check whether --with-included-gettext or --without-included-gettext was given.
  15316. +# Check whether --with-included-gettext or --without-included-gettext was given.
  15317.  if test "${with_included_gettext+set}" = set; then
  15318.    withval="$with_included_gettext"
  15319.    nls_cv_force_use_gnu_gettext=$withval
  15320.  else
  15321.    nls_cv_force_use_gnu_gettext=no
  15322. -fi
  15323. -
  15324. -      echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
  15325. +fi;
  15326. +      echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5
  15327. +echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6
  15328.  
  15329.        nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  15330.        if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  15331. @@ -3838,141 +6766,298 @@
  15332.      nls_cv_header_libgt=
  15333.      CATOBJEXT=NONE
  15334.  
  15335. -    ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
  15336. -echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
  15337. -echo "configure:3844: checking for libintl.h" >&5
  15338. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  15339. -  echo $ac_n "(cached) $ac_c" 1>&6
  15340. -else
  15341. -  cat > conftest.$ac_ext <<EOF
  15342. -#line 3849 "configure"
  15343. -#include "confdefs.h"
  15344. +    if test "${ac_cv_header_libintl_h+set}" = set; then
  15345. +  echo "$as_me:$LINENO: checking for libintl.h" >&5
  15346. +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6
  15347. +if test "${ac_cv_header_libintl_h+set}" = set; then
  15348. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15349. +fi
  15350. +echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5
  15351. +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6
  15352. +else
  15353. +  # Is the header compilable?
  15354. +echo "$as_me:$LINENO: checking libintl.h usability" >&5
  15355. +echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6
  15356. +cat >conftest.$ac_ext <<_ACEOF
  15357. +#line $LINENO "configure"
  15358. +/* confdefs.h.  */
  15359. +_ACEOF
  15360. +cat confdefs.h >>conftest.$ac_ext
  15361. +cat >>conftest.$ac_ext <<_ACEOF
  15362. +/* end confdefs.h.  */
  15363. +$ac_includes_default
  15364.  #include <libintl.h>
  15365. -EOF
  15366. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  15367. -{ (eval echo configure:3854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  15368. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  15369. -if test -z "$ac_err"; then
  15370. -  rm -rf conftest*
  15371. -  eval "ac_cv_header_$ac_safe=yes"
  15372. -else
  15373. -  echo "$ac_err" >&5
  15374. -  echo "configure: failed program was:" >&5
  15375. -  cat conftest.$ac_ext >&5
  15376. -  rm -rf conftest*
  15377. -  eval "ac_cv_header_$ac_safe=no"
  15378. -fi
  15379. -rm -f conftest*
  15380. -fi
  15381. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  15382. -  echo "$ac_t""yes" 1>&6
  15383. -  echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
  15384. -echo "configure:3871: checking for gettext in libc" >&5
  15385. -if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
  15386. -  echo $ac_n "(cached) $ac_c" 1>&6
  15387. -else
  15388. -  cat > conftest.$ac_ext <<EOF
  15389. -#line 3876 "configure"
  15390. -#include "confdefs.h"
  15391. +_ACEOF
  15392. +rm -f conftest.$ac_objext
  15393. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  15394. +  (eval $ac_compile) 2>&5
  15395. +  ac_status=$?
  15396. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15397. +  (exit $ac_status); } &&
  15398. +         { ac_try='test -s conftest.$ac_objext'
  15399. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15400. +  (eval $ac_try) 2>&5
  15401. +  ac_status=$?
  15402. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15403. +  (exit $ac_status); }; }; then
  15404. +  ac_header_compiler=yes
  15405. +else
  15406. +  echo "$as_me: failed program was:" >&5
  15407. +sed 's/^/| /' conftest.$ac_ext >&5
  15408. +
  15409. +ac_header_compiler=no
  15410. +fi
  15411. +rm -f conftest.$ac_objext conftest.$ac_ext
  15412. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  15413. +echo "${ECHO_T}$ac_header_compiler" >&6
  15414. +
  15415. +# Is the header present?
  15416. +echo "$as_me:$LINENO: checking libintl.h presence" >&5
  15417. +echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6
  15418. +cat >conftest.$ac_ext <<_ACEOF
  15419. +#line $LINENO "configure"
  15420. +/* confdefs.h.  */
  15421. +_ACEOF
  15422. +cat confdefs.h >>conftest.$ac_ext
  15423. +cat >>conftest.$ac_ext <<_ACEOF
  15424. +/* end confdefs.h.  */
  15425. +#include <libintl.h>
  15426. +_ACEOF
  15427. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  15428. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  15429. +  ac_status=$?
  15430. +  grep -v '^ *+' conftest.er1 >conftest.err
  15431. +  rm -f conftest.er1
  15432. +  cat conftest.err >&5
  15433. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15434. +  (exit $ac_status); } >/dev/null; then
  15435. +  if test -s conftest.err; then
  15436. +    ac_cpp_err=$ac_c_preproc_warn_flag
  15437. +  else
  15438. +    ac_cpp_err=
  15439. +  fi
  15440. +else
  15441. +  ac_cpp_err=yes
  15442. +fi
  15443. +if test -z "$ac_cpp_err"; then
  15444. +  ac_header_preproc=yes
  15445. +else
  15446. +  echo "$as_me: failed program was:" >&5
  15447. +sed 's/^/| /' conftest.$ac_ext >&5
  15448. +
  15449. +  ac_header_preproc=no
  15450. +fi
  15451. +rm -f conftest.err conftest.$ac_ext
  15452. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  15453. +echo "${ECHO_T}$ac_header_preproc" >&6
  15454. +
  15455. +# So?  What about this header?
  15456. +case $ac_header_compiler:$ac_header_preproc in
  15457. +  yes:no )
  15458. +    { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5
  15459. +echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
  15460. +    { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5
  15461. +echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;}
  15462. +    (
  15463. +      cat <<\_ASBOX
  15464. +## ------------------------------------ ##
  15465. +## Report this to bug-autoconf@gnu.org. ##
  15466. +## ------------------------------------ ##
  15467. +_ASBOX
  15468. +    ) |
  15469. +      sed "s/^/$as_me: WARNING:     /" >&2
  15470. +    ;;
  15471. +  no:yes )
  15472. +    { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5
  15473. +echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;}
  15474. +    { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5
  15475. +echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;}
  15476. +    { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5
  15477. +echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;}
  15478. +    (
  15479. +      cat <<\_ASBOX
  15480. +## ------------------------------------ ##
  15481. +## Report this to bug-autoconf@gnu.org. ##
  15482. +## ------------------------------------ ##
  15483. +_ASBOX
  15484. +    ) |
  15485. +      sed "s/^/$as_me: WARNING:     /" >&2
  15486. +    ;;
  15487. +esac
  15488. +echo "$as_me:$LINENO: checking for libintl.h" >&5
  15489. +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6
  15490. +if test "${ac_cv_header_libintl_h+set}" = set; then
  15491. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15492. +else
  15493. +  ac_cv_header_libintl_h=$ac_header_preproc
  15494. +fi
  15495. +echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5
  15496. +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6
  15497. +
  15498. +fi
  15499. +if test $ac_cv_header_libintl_h = yes; then
  15500. +  echo "$as_me:$LINENO: checking for gettext in libc" >&5
  15501. +echo $ECHO_N "checking for gettext in libc... $ECHO_C" >&6
  15502. +if test "${gt_cv_func_gettext_libc+set}" = set; then
  15503. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15504. +else
  15505. +  cat >conftest.$ac_ext <<_ACEOF
  15506. +#line $LINENO "configure"
  15507. +/* confdefs.h.  */
  15508. +_ACEOF
  15509. +cat confdefs.h >>conftest.$ac_ext
  15510. +cat >>conftest.$ac_ext <<_ACEOF
  15511. +/* end confdefs.h.  */
  15512.  #include <libintl.h>
  15513. -int main() {
  15514. +int
  15515. +main ()
  15516. +{
  15517.  return (int) gettext ("")
  15518. -; return 0; }
  15519. -EOF
  15520. -if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15521. -  rm -rf conftest*
  15522. +  ;
  15523. +  return 0;
  15524. +}
  15525. +_ACEOF
  15526. +rm -f conftest.$ac_objext conftest$ac_exeext
  15527. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15528. +  (eval $ac_link) 2>&5
  15529. +  ac_status=$?
  15530. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15531. +  (exit $ac_status); } &&
  15532. +         { ac_try='test -s conftest$ac_exeext'
  15533. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15534. +  (eval $ac_try) 2>&5
  15535. +  ac_status=$?
  15536. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15537. +  (exit $ac_status); }; }; then
  15538.    gt_cv_func_gettext_libc=yes
  15539.  else
  15540. -  echo "configure: failed program was:" >&5
  15541. -  cat conftest.$ac_ext >&5
  15542. -  rm -rf conftest*
  15543. -  gt_cv_func_gettext_libc=no
  15544. +  echo "$as_me: failed program was:" >&5
  15545. +sed 's/^/| /' conftest.$ac_ext >&5
  15546. +
  15547. +gt_cv_func_gettext_libc=no
  15548.  fi
  15549. -rm -f conftest*
  15550. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  15551.  fi
  15552. -
  15553. -echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
  15554. +echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libc" >&5
  15555. +echo "${ECHO_T}$gt_cv_func_gettext_libc" >&6
  15556.  
  15557.         if test "$gt_cv_func_gettext_libc" != "yes"; then
  15558. -         echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
  15559. -echo "configure:3899: checking for bindtextdomain in -lintl" >&5
  15560. -ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
  15561. -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  15562. -  echo $ac_n "(cached) $ac_c" 1>&6
  15563. +         echo "$as_me:$LINENO: checking for bindtextdomain in -lintl" >&5
  15564. +echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6
  15565. +if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then
  15566. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15567.  else
  15568. -  ac_save_LIBS="$LIBS"
  15569. +  ac_check_lib_save_LIBS=$LIBS
  15570.  LIBS="-lintl  $LIBS"
  15571. -cat > conftest.$ac_ext <<EOF
  15572. -#line 3907 "configure"
  15573. -#include "confdefs.h"
  15574. +cat >conftest.$ac_ext <<_ACEOF
  15575. +#line $LINENO "configure"
  15576. +/* confdefs.h.  */
  15577. +_ACEOF
  15578. +cat confdefs.h >>conftest.$ac_ext
  15579. +cat >>conftest.$ac_ext <<_ACEOF
  15580. +/* end confdefs.h.  */
  15581. +
  15582.  /* Override any gcc2 internal prototype to avoid an error.  */
  15583. +#ifdef __cplusplus
  15584. +extern "C"
  15585. +#endif
  15586.  /* We use char because int might match the return type of a gcc2
  15587.      builtin and then its argument prototype would still apply.  */
  15588. -char bindtextdomain();
  15589. -
  15590. -int main() {
  15591. -bindtextdomain()
  15592. -; return 0; }
  15593. -EOF
  15594. -if { (eval echo configure:3918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15595. -  rm -rf conftest*
  15596. -  eval "ac_cv_lib_$ac_lib_var=yes"
  15597. -else
  15598. -  echo "configure: failed program was:" >&5
  15599. -  cat conftest.$ac_ext >&5
  15600. -  rm -rf conftest*
  15601. -  eval "ac_cv_lib_$ac_lib_var=no"
  15602. -fi
  15603. -rm -f conftest*
  15604. -LIBS="$ac_save_LIBS"
  15605. -
  15606. -fi
  15607. -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  15608. -  echo "$ac_t""yes" 1>&6
  15609. -  echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
  15610. -echo "configure:3934: checking for gettext in libintl" >&5
  15611. -if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
  15612. -  echo $ac_n "(cached) $ac_c" 1>&6
  15613. -else
  15614. -  cat > conftest.$ac_ext <<EOF
  15615. -#line 3939 "configure"
  15616. -#include "confdefs.h"
  15617. +char bindtextdomain ();
  15618. +int
  15619. +main ()
  15620. +{
  15621. +bindtextdomain ();
  15622. +  ;
  15623. +  return 0;
  15624. +}
  15625. +_ACEOF
  15626. +rm -f conftest.$ac_objext conftest$ac_exeext
  15627. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15628. +  (eval $ac_link) 2>&5
  15629. +  ac_status=$?
  15630. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15631. +  (exit $ac_status); } &&
  15632. +         { ac_try='test -s conftest$ac_exeext'
  15633. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15634. +  (eval $ac_try) 2>&5
  15635. +  ac_status=$?
  15636. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15637. +  (exit $ac_status); }; }; then
  15638. +  ac_cv_lib_intl_bindtextdomain=yes
  15639. +else
  15640. +  echo "$as_me: failed program was:" >&5
  15641. +sed 's/^/| /' conftest.$ac_ext >&5
  15642. +
  15643. +ac_cv_lib_intl_bindtextdomain=no
  15644. +fi
  15645. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  15646. +LIBS=$ac_check_lib_save_LIBS
  15647. +fi
  15648. +echo "$as_me:$LINENO: result: $ac_cv_lib_intl_bindtextdomain" >&5
  15649. +echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6
  15650. +if test $ac_cv_lib_intl_bindtextdomain = yes; then
  15651. +  echo "$as_me:$LINENO: checking for gettext in libintl" >&5
  15652. +echo $ECHO_N "checking for gettext in libintl... $ECHO_C" >&6
  15653. +if test "${gt_cv_func_gettext_libintl+set}" = set; then
  15654. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15655. +else
  15656. +  cat >conftest.$ac_ext <<_ACEOF
  15657. +#line $LINENO "configure"
  15658. +/* confdefs.h.  */
  15659. +_ACEOF
  15660. +cat confdefs.h >>conftest.$ac_ext
  15661. +cat >>conftest.$ac_ext <<_ACEOF
  15662. +/* end confdefs.h.  */
  15663.  
  15664. -int main() {
  15665. +int
  15666. +main ()
  15667. +{
  15668.  return (int) gettext ("")
  15669. -; return 0; }
  15670. -EOF
  15671. -if { (eval echo configure:3946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15672. -  rm -rf conftest*
  15673. +  ;
  15674. +  return 0;
  15675. +}
  15676. +_ACEOF
  15677. +rm -f conftest.$ac_objext conftest$ac_exeext
  15678. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15679. +  (eval $ac_link) 2>&5
  15680. +  ac_status=$?
  15681. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15682. +  (exit $ac_status); } &&
  15683. +         { ac_try='test -s conftest$ac_exeext'
  15684. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15685. +  (eval $ac_try) 2>&5
  15686. +  ac_status=$?
  15687. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15688. +  (exit $ac_status); }; }; then
  15689.    gt_cv_func_gettext_libintl=yes
  15690.  else
  15691. -  echo "configure: failed program was:" >&5
  15692. -  cat conftest.$ac_ext >&5
  15693. -  rm -rf conftest*
  15694. -  gt_cv_func_gettext_libintl=no
  15695. +  echo "$as_me: failed program was:" >&5
  15696. +sed 's/^/| /' conftest.$ac_ext >&5
  15697. +
  15698. +gt_cv_func_gettext_libintl=no
  15699.  fi
  15700. -rm -f conftest*
  15701. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  15702.  fi
  15703. -
  15704. -echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
  15705. -else
  15706. -  echo "$ac_t""no" 1>&6
  15707. +echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libintl" >&5
  15708. +echo "${ECHO_T}$gt_cv_func_gettext_libintl" >&6
  15709.  fi
  15710.  
  15711.         fi
  15712.  
  15713.         if test "$gt_cv_func_gettext_libc" = "yes" \
  15714.            || test "$gt_cv_func_gettext_libintl" = "yes"; then
  15715. -          cat >> confdefs.h <<\EOF
  15716. +
  15717. +cat >>confdefs.h <<\_ACEOF
  15718.  #define HAVE_GETTEXT 1
  15719. -EOF
  15720. +_ACEOF
  15721.  
  15722.            # Extract the first word of "msgfmt", so it can be a program name with args.
  15723.  set dummy msgfmt; ac_word=$2
  15724. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  15725. -echo "configure:3974: checking for $ac_word" >&5
  15726. -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
  15727. -  echo $ac_n "(cached) $ac_c" 1>&6
  15728. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  15729. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  15730. +if test "${ac_cv_path_MSGFMT+set}" = set; then
  15731. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15732.  else
  15733.    case "$MSGFMT" in
  15734.    /*)
  15735. @@ -3996,108 +7081,143 @@
  15736.  fi
  15737.  MSGFMT="$ac_cv_path_MSGFMT"
  15738.  if test -n "$MSGFMT"; then
  15739. -  echo "$ac_t""$MSGFMT" 1>&6
  15740. +  echo "$as_me:$LINENO: result: $MSGFMT" >&5
  15741. +echo "${ECHO_T}$MSGFMT" >&6
  15742.  else
  15743. -  echo "$ac_t""no" 1>&6
  15744. +  echo "$as_me:$LINENO: result: no" >&5
  15745. +echo "${ECHO_T}no" >&6
  15746.  fi
  15747.            if test "$MSGFMT" != "no"; then
  15748. -        for ac_func in dcgettext
  15749. +
  15750. +for ac_func in dcgettext
  15751.  do
  15752. -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  15753. -echo "configure:4008: checking for $ac_func" >&5
  15754. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  15755. -  echo $ac_n "(cached) $ac_c" 1>&6
  15756. -else
  15757. -  cat > conftest.$ac_ext <<EOF
  15758. -#line 4013 "configure"
  15759. -#include "confdefs.h"
  15760. +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  15761. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  15762. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  15763. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  15764. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15765. +else
  15766. +  cat >conftest.$ac_ext <<_ACEOF
  15767. +#line $LINENO "configure"
  15768. +/* confdefs.h.  */
  15769. +_ACEOF
  15770. +cat confdefs.h >>conftest.$ac_ext
  15771. +cat >>conftest.$ac_ext <<_ACEOF
  15772. +/* end confdefs.h.  */
  15773.  /* System header to define __stub macros and hopefully few prototypes,
  15774. -    which can conflict with char $ac_func(); below.  */
  15775. -#include <assert.h>
  15776. +    which can conflict with char $ac_func (); below.
  15777. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  15778. +    <limits.h> exists even on freestanding compilers.  */
  15779. +#ifdef __STDC__
  15780. +# include <limits.h>
  15781. +#else
  15782. +# include <assert.h>
  15783. +#endif
  15784.  /* Override any gcc2 internal prototype to avoid an error.  */
  15785. +#ifdef __cplusplus
  15786. +extern "C"
  15787. +{
  15788. +#endif
  15789.  /* We use char because int might match the return type of a gcc2
  15790.      builtin and then its argument prototype would still apply.  */
  15791. -char $ac_func();
  15792. -
  15793. -int main() {
  15794. -
  15795. +char $ac_func ();
  15796.  /* The GNU C library defines this for functions which it implements
  15797.      to always fail with ENOSYS.  Some functions are actually named
  15798.      something starting with __ and the normal name is an alias.  */
  15799.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  15800.  choke me
  15801.  #else
  15802. -$ac_func();
  15803. +char (*f) () = $ac_func;
  15804. +#endif
  15805. +#ifdef __cplusplus
  15806. +}
  15807.  #endif
  15808.  
  15809. -; return 0; }
  15810. -EOF
  15811. -if { (eval echo configure:4036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15812. -  rm -rf conftest*
  15813. -  eval "ac_cv_func_$ac_func=yes"
  15814. -else
  15815. -  echo "configure: failed program was:" >&5
  15816. -  cat conftest.$ac_ext >&5
  15817. -  rm -rf conftest*
  15818. -  eval "ac_cv_func_$ac_func=no"
  15819. -fi
  15820. -rm -f conftest*
  15821. -fi
  15822. -
  15823. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  15824. -  echo "$ac_t""yes" 1>&6
  15825. -    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  15826. -  cat >> confdefs.h <<EOF
  15827. -#define $ac_tr_func 1
  15828. -EOF
  15829. +int
  15830. +main ()
  15831. +{
  15832. +return f != $ac_func;
  15833. +  ;
  15834. +  return 0;
  15835. +}
  15836. +_ACEOF
  15837. +rm -f conftest.$ac_objext conftest$ac_exeext
  15838. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15839. +  (eval $ac_link) 2>&5
  15840. +  ac_status=$?
  15841. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15842. +  (exit $ac_status); } &&
  15843. +         { ac_try='test -s conftest$ac_exeext'
  15844. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15845. +  (eval $ac_try) 2>&5
  15846. +  ac_status=$?
  15847. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15848. +  (exit $ac_status); }; }; then
  15849. +  eval "$as_ac_var=yes"
  15850. +else
  15851. +  echo "$as_me: failed program was:" >&5
  15852. +sed 's/^/| /' conftest.$ac_ext >&5
  15853. +
  15854. +eval "$as_ac_var=no"
  15855. +fi
  15856. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  15857. +fi
  15858. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  15859. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  15860. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  15861. +  cat >>confdefs.h <<_ACEOF
  15862. +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  15863. +_ACEOF
  15864.   
  15865. -else
  15866. -  echo "$ac_t""no" 1>&6
  15867.  fi
  15868.  done
  15869.  
  15870.          # Extract the first word of "gmsgfmt", so it can be a program name with args.
  15871.  set dummy gmsgfmt; ac_word=$2
  15872. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  15873. -echo "configure:4063: checking for $ac_word" >&5
  15874. -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
  15875. -  echo $ac_n "(cached) $ac_c" 1>&6
  15876. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  15877. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  15878. +if test "${ac_cv_path_GMSGFMT+set}" = set; then
  15879. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15880.  else
  15881. -  case "$GMSGFMT" in
  15882. -  /*)
  15883. +  case $GMSGFMT in
  15884. +  [\\/]* | ?:[\\/]*)
  15885.    ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
  15886.    ;;
  15887. -  ?:/*)             
  15888. -  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
  15889. -  ;;
  15890.    *)
  15891. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  15892. -  ac_dummy="$PATH"
  15893. -  for ac_dir in $ac_dummy; do 
  15894. -    test -z "$ac_dir" && ac_dir=.
  15895. -    if test -f $ac_dir/$ac_word; then
  15896. -      ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
  15897. -      break
  15898. +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  15899. +for as_dir in $PATH
  15900. +do
  15901. +  IFS=$as_save_IFS
  15902. +  test -z "$as_dir" && as_dir=.
  15903. +  for ac_exec_ext in '' $ac_executable_extensions; do
  15904. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  15905. +    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
  15906. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  15907. +    break 2
  15908.      fi
  15909. -  done
  15910. -  IFS="$ac_save_ifs"
  15911. +done
  15912. +done
  15913. +
  15914.    test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
  15915.    ;;
  15916.  esac
  15917.  fi
  15918. -GMSGFMT="$ac_cv_path_GMSGFMT"
  15919. +GMSGFMT=$ac_cv_path_GMSGFMT
  15920. +
  15921.  if test -n "$GMSGFMT"; then
  15922. -  echo "$ac_t""$GMSGFMT" 1>&6
  15923. +  echo "$as_me:$LINENO: result: $GMSGFMT" >&5
  15924. +echo "${ECHO_T}$GMSGFMT" >&6
  15925.  else
  15926. -  echo "$ac_t""no" 1>&6
  15927. +  echo "$as_me:$LINENO: result: no" >&5
  15928. +echo "${ECHO_T}no" >&6
  15929.  fi
  15930.  
  15931.          # Extract the first word of "xgettext", so it can be a program name with args.
  15932.  set dummy xgettext; ac_word=$2
  15933. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  15934. -echo "configure:4099: checking for $ac_word" >&5
  15935. -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
  15936. -  echo $ac_n "(cached) $ac_c" 1>&6
  15937. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  15938. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  15939. +if test "${ac_cv_path_XGETTEXT+set}" = set; then
  15940. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  15941.  else
  15942.    case "$XGETTEXT" in
  15943.    /*)
  15944. @@ -4121,38 +7241,56 @@
  15945.  fi
  15946.  XGETTEXT="$ac_cv_path_XGETTEXT"
  15947.  if test -n "$XGETTEXT"; then
  15948. -  echo "$ac_t""$XGETTEXT" 1>&6
  15949. +  echo "$as_me:$LINENO: result: $XGETTEXT" >&5
  15950. +echo "${ECHO_T}$XGETTEXT" >&6
  15951.  else
  15952. -  echo "$ac_t""no" 1>&6
  15953. +  echo "$as_me:$LINENO: result: no" >&5
  15954. +echo "${ECHO_T}no" >&6
  15955.  fi
  15956.  
  15957. -        cat > conftest.$ac_ext <<EOF
  15958. -#line 4131 "configure"
  15959. -#include "confdefs.h"
  15960. +        cat >conftest.$ac_ext <<_ACEOF
  15961. +#line $LINENO "configure"
  15962. +/* confdefs.h.  */
  15963. +_ACEOF
  15964. +cat confdefs.h >>conftest.$ac_ext
  15965. +cat >>conftest.$ac_ext <<_ACEOF
  15966. +/* end confdefs.h.  */
  15967.  
  15968. -int main() {
  15969. +int
  15970. +main ()
  15971. +{
  15972.  extern int _nl_msg_cat_cntr;
  15973.                     return _nl_msg_cat_cntr
  15974. -; return 0; }
  15975. -EOF
  15976. -if { (eval echo configure:4139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  15977. -  rm -rf conftest*
  15978. +  ;
  15979. +  return 0;
  15980. +}
  15981. +_ACEOF
  15982. +rm -f conftest.$ac_objext conftest$ac_exeext
  15983. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  15984. +  (eval $ac_link) 2>&5
  15985. +  ac_status=$?
  15986. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15987. +  (exit $ac_status); } &&
  15988. +         { ac_try='test -s conftest$ac_exeext'
  15989. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  15990. +  (eval $ac_try) 2>&5
  15991. +  ac_status=$?
  15992. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  15993. +  (exit $ac_status); }; }; then
  15994.    CATOBJEXT=.gmo
  15995.             DATADIRNAME=share
  15996.  else
  15997. -  echo "configure: failed program was:" >&5
  15998. -  cat conftest.$ac_ext >&5
  15999. -  rm -rf conftest*
  16000. -  CATOBJEXT=.mo
  16001. +  echo "$as_me: failed program was:" >&5
  16002. +sed 's/^/| /' conftest.$ac_ext >&5
  16003. +
  16004. +CATOBJEXT=.mo
  16005.             DATADIRNAME=lib
  16006.  fi
  16007. -rm -f conftest*
  16008. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  16009.          INSTOBJEXT=.mo
  16010.            fi
  16011.          fi
  16012.      
  16013. -else
  16014. -  echo "$ac_t""no" 1>&6
  16015.  fi
  16016.  
  16017.  
  16018. @@ -4166,10 +7304,10 @@
  16019.                  INTLOBJS="\$(GETTOBJS)"
  16020.          # Extract the first word of "msgfmt", so it can be a program name with args.
  16021.  set dummy msgfmt; ac_word=$2
  16022. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  16023. -echo "configure:4171: checking for $ac_word" >&5
  16024. -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
  16025. -  echo $ac_n "(cached) $ac_c" 1>&6
  16026. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  16027. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  16028. +if test "${ac_cv_path_MSGFMT+set}" = set; then
  16029. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16030.  else
  16031.    case "$MSGFMT" in
  16032.    /*)
  16033. @@ -4193,53 +7331,59 @@
  16034.  fi
  16035.  MSGFMT="$ac_cv_path_MSGFMT"
  16036.  if test -n "$MSGFMT"; then
  16037. -  echo "$ac_t""$MSGFMT" 1>&6
  16038. +  echo "$as_me:$LINENO: result: $MSGFMT" >&5
  16039. +echo "${ECHO_T}$MSGFMT" >&6
  16040.  else
  16041. -  echo "$ac_t""no" 1>&6
  16042. +  echo "$as_me:$LINENO: result: no" >&5
  16043. +echo "${ECHO_T}no" >&6
  16044.  fi
  16045.  
  16046.          # Extract the first word of "gmsgfmt", so it can be a program name with args.
  16047.  set dummy gmsgfmt; ac_word=$2
  16048. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  16049. -echo "configure:4205: checking for $ac_word" >&5
  16050. -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
  16051. -  echo $ac_n "(cached) $ac_c" 1>&6
  16052. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  16053. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  16054. +if test "${ac_cv_path_GMSGFMT+set}" = set; then
  16055. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16056.  else
  16057. -  case "$GMSGFMT" in
  16058. -  /*)
  16059. +  case $GMSGFMT in
  16060. +  [\\/]* | ?:[\\/]*)
  16061.    ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
  16062.    ;;
  16063. -  ?:/*)             
  16064. -  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
  16065. -  ;;
  16066.    *)
  16067. -  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS=":"
  16068. -  ac_dummy="$PATH"
  16069. -  for ac_dir in $ac_dummy; do 
  16070. -    test -z "$ac_dir" && ac_dir=.
  16071. -    if test -f $ac_dir/$ac_word; then
  16072. -      ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
  16073. -      break
  16074. +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  16075. +for as_dir in $PATH
  16076. +do
  16077. +  IFS=$as_save_IFS
  16078. +  test -z "$as_dir" && as_dir=.
  16079. +  for ac_exec_ext in '' $ac_executable_extensions; do
  16080. +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  16081. +    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
  16082. +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  16083. +    break 2
  16084.      fi
  16085. -  done
  16086. -  IFS="$ac_save_ifs"
  16087. +done
  16088. +done
  16089. +
  16090.    test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
  16091.    ;;
  16092.  esac
  16093.  fi
  16094. -GMSGFMT="$ac_cv_path_GMSGFMT"
  16095. +GMSGFMT=$ac_cv_path_GMSGFMT
  16096. +
  16097.  if test -n "$GMSGFMT"; then
  16098. -  echo "$ac_t""$GMSGFMT" 1>&6
  16099. +  echo "$as_me:$LINENO: result: $GMSGFMT" >&5
  16100. +echo "${ECHO_T}$GMSGFMT" >&6
  16101.  else
  16102. -  echo "$ac_t""no" 1>&6
  16103. +  echo "$as_me:$LINENO: result: no" >&5
  16104. +echo "${ECHO_T}no" >&6
  16105.  fi
  16106.  
  16107.          # Extract the first word of "xgettext", so it can be a program name with args.
  16108.  set dummy xgettext; ac_word=$2
  16109. -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
  16110. -echo "configure:4241: checking for $ac_word" >&5
  16111. -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
  16112. -  echo $ac_n "(cached) $ac_c" 1>&6
  16113. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  16114. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  16115. +if test "${ac_cv_path_XGETTEXT+set}" = set; then
  16116. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16117.  else
  16118.    case "$XGETTEXT" in
  16119.    /*)
  16120. @@ -4263,9 +7407,11 @@
  16121.  fi
  16122.  XGETTEXT="$ac_cv_path_XGETTEXT"
  16123.  if test -n "$XGETTEXT"; then
  16124. -  echo "$ac_t""$XGETTEXT" 1>&6
  16125. +  echo "$as_me:$LINENO: result: $XGETTEXT" >&5
  16126. +echo "${ECHO_T}$XGETTEXT" >&6
  16127.  else
  16128. -  echo "$ac_t""no" 1>&6
  16129. +  echo "$as_me:$LINENO: result: no" >&5
  16130. +echo "${ECHO_T}no" >&6
  16131.  fi
  16132.  
  16133.          
  16134. @@ -4284,7 +7430,8 @@
  16135.              if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  16136.        : ;
  16137.      else
  16138. -      echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6
  16139. +      echo "$as_me:$LINENO: result: found xgettext programs is not GNU xgettext; ignore it" >&5
  16140. +echo "${ECHO_T}found xgettext programs is not GNU xgettext; ignore it" >&6
  16141.        XGETTEXT=":"
  16142.      fi
  16143.        fi
  16144. @@ -4326,8 +7473,8 @@
  16145.       if test "x$ALL_LINGUAS" = "x"; then
  16146.         LINGUAS=
  16147.       else
  16148. -       echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
  16149. -echo "configure:4331: checking for catalogs to be installed" >&5
  16150. +       echo "$as_me:$LINENO: checking for catalogs to be installed" >&5
  16151. +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6
  16152.         NEW_LINGUAS=
  16153.         for lang in ${LINGUAS=$ALL_LINGUAS}; do
  16154.           case "$ALL_LINGUAS" in
  16155. @@ -4335,7 +7482,8 @@
  16156.           esac
  16157.         done
  16158.         LINGUAS=$NEW_LINGUAS
  16159. -       echo "$ac_t""$LINGUAS" 1>&6
  16160. +       echo "$as_me:$LINENO: result: $LINGUAS" >&5
  16161. +echo "${ECHO_T}$LINGUAS" >&6
  16162.       fi
  16163.  
  16164.            if test -n "$LINGUAS"; then
  16165. @@ -4353,38 +7501,139 @@
  16166.  
  16167.              if test -f $srcdir/po2tbl.sed.in; then
  16168.        if test "$CATOBJEXT" = ".cat"; then
  16169. -     ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
  16170. -echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
  16171. -echo "configure:4359: checking for linux/version.h" >&5
  16172. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  16173. -  echo $ac_n "(cached) $ac_c" 1>&6
  16174. -else
  16175. -  cat > conftest.$ac_ext <<EOF
  16176. -#line 4364 "configure"
  16177. -#include "confdefs.h"
  16178. +     if test "${ac_cv_header_linux_version_h+set}" = set; then
  16179. +  echo "$as_me:$LINENO: checking for linux/version.h" >&5
  16180. +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6
  16181. +if test "${ac_cv_header_linux_version_h+set}" = set; then
  16182. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16183. +fi
  16184. +echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5
  16185. +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6
  16186. +else
  16187. +  # Is the header compilable?
  16188. +echo "$as_me:$LINENO: checking linux/version.h usability" >&5
  16189. +echo $ECHO_N "checking linux/version.h usability... $ECHO_C" >&6
  16190. +cat >conftest.$ac_ext <<_ACEOF
  16191. +#line $LINENO "configure"
  16192. +/* confdefs.h.  */
  16193. +_ACEOF
  16194. +cat confdefs.h >>conftest.$ac_ext
  16195. +cat >>conftest.$ac_ext <<_ACEOF
  16196. +/* end confdefs.h.  */
  16197. +$ac_includes_default
  16198.  #include <linux/version.h>
  16199. -EOF
  16200. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  16201. -{ (eval echo configure:4369: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  16202. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  16203. -if test -z "$ac_err"; then
  16204. -  rm -rf conftest*
  16205. -  eval "ac_cv_header_$ac_safe=yes"
  16206. +_ACEOF
  16207. +rm -f conftest.$ac_objext
  16208. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  16209. +  (eval $ac_compile) 2>&5
  16210. +  ac_status=$?
  16211. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16212. +  (exit $ac_status); } &&
  16213. +         { ac_try='test -s conftest.$ac_objext'
  16214. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  16215. +  (eval $ac_try) 2>&5
  16216. +  ac_status=$?
  16217. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16218. +  (exit $ac_status); }; }; then
  16219. +  ac_header_compiler=yes
  16220. +else
  16221. +  echo "$as_me: failed program was:" >&5
  16222. +sed 's/^/| /' conftest.$ac_ext >&5
  16223. +
  16224. +ac_header_compiler=no
  16225. +fi
  16226. +rm -f conftest.$ac_objext conftest.$ac_ext
  16227. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  16228. +echo "${ECHO_T}$ac_header_compiler" >&6
  16229. +
  16230. +# Is the header present?
  16231. +echo "$as_me:$LINENO: checking linux/version.h presence" >&5
  16232. +echo $ECHO_N "checking linux/version.h presence... $ECHO_C" >&6
  16233. +cat >conftest.$ac_ext <<_ACEOF
  16234. +#line $LINENO "configure"
  16235. +/* confdefs.h.  */
  16236. +_ACEOF
  16237. +cat confdefs.h >>conftest.$ac_ext
  16238. +cat >>conftest.$ac_ext <<_ACEOF
  16239. +/* end confdefs.h.  */
  16240. +#include <linux/version.h>
  16241. +_ACEOF
  16242. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  16243. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  16244. +  ac_status=$?
  16245. +  grep -v '^ *+' conftest.er1 >conftest.err
  16246. +  rm -f conftest.er1
  16247. +  cat conftest.err >&5
  16248. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16249. +  (exit $ac_status); } >/dev/null; then
  16250. +  if test -s conftest.err; then
  16251. +    ac_cpp_err=$ac_c_preproc_warn_flag
  16252. +  else
  16253. +    ac_cpp_err=
  16254. +  fi
  16255. +else
  16256. +  ac_cpp_err=yes
  16257. +fi
  16258. +if test -z "$ac_cpp_err"; then
  16259. +  ac_header_preproc=yes
  16260. +else
  16261. +  echo "$as_me: failed program was:" >&5
  16262. +sed 's/^/| /' conftest.$ac_ext >&5
  16263. +
  16264. +  ac_header_preproc=no
  16265. +fi
  16266. +rm -f conftest.err conftest.$ac_ext
  16267. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  16268. +echo "${ECHO_T}$ac_header_preproc" >&6
  16269. +
  16270. +# So?  What about this header?
  16271. +case $ac_header_compiler:$ac_header_preproc in
  16272. +  yes:no )
  16273. +    { echo "$as_me:$LINENO: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&5
  16274. +echo "$as_me: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
  16275. +    { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the preprocessor's result" >&5
  16276. +echo "$as_me: WARNING: linux/version.h: proceeding with the preprocessor's result" >&2;}
  16277. +    (
  16278. +      cat <<\_ASBOX
  16279. +## ------------------------------------ ##
  16280. +## Report this to bug-autoconf@gnu.org. ##
  16281. +## ------------------------------------ ##
  16282. +_ASBOX
  16283. +    ) |
  16284. +      sed "s/^/$as_me: WARNING:     /" >&2
  16285. +    ;;
  16286. +  no:yes )
  16287. +    { echo "$as_me:$LINENO: WARNING: linux/version.h: present but cannot be compiled" >&5
  16288. +echo "$as_me: WARNING: linux/version.h: present but cannot be compiled" >&2;}
  16289. +    { echo "$as_me:$LINENO: WARNING: linux/version.h: check for missing prerequisite headers?" >&5
  16290. +echo "$as_me: WARNING: linux/version.h: check for missing prerequisite headers?" >&2;}
  16291. +    { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the preprocessor's result" >&5
  16292. +echo "$as_me: WARNING: linux/version.h: proceeding with the preprocessor's result" >&2;}
  16293. +    (
  16294. +      cat <<\_ASBOX
  16295. +## ------------------------------------ ##
  16296. +## Report this to bug-autoconf@gnu.org. ##
  16297. +## ------------------------------------ ##
  16298. +_ASBOX
  16299. +    ) |
  16300. +      sed "s/^/$as_me: WARNING:     /" >&2
  16301. +    ;;
  16302. +esac
  16303. +echo "$as_me:$LINENO: checking for linux/version.h" >&5
  16304. +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6
  16305. +if test "${ac_cv_header_linux_version_h+set}" = set; then
  16306. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16307.  else
  16308. -  echo "$ac_err" >&5
  16309. -  echo "configure: failed program was:" >&5
  16310. -  cat conftest.$ac_ext >&5
  16311. -  rm -rf conftest*
  16312. -  eval "ac_cv_header_$ac_safe=no"
  16313. +  ac_cv_header_linux_version_h=$ac_header_preproc
  16314.  fi
  16315. -rm -f conftest*
  16316. +echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5
  16317. +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6
  16318. +
  16319.  fi
  16320. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  16321. -  echo "$ac_t""yes" 1>&6
  16322. +if test $ac_cv_header_linux_version_h = yes; then
  16323.    msgformat=linux
  16324.  else
  16325. -  echo "$ac_t""no" 1>&6
  16326. -msgformat=xopen
  16327. +  msgformat=xopen
  16328.  fi
  16329.  
  16330.  
  16331. @@ -4438,60 +7687,73 @@
  16332.  # SunOS /usr/etc/install
  16333.  # IRIX /sbin/install
  16334.  # AIX /bin/install
  16335. +# AmigaOS /C/install, which installs bootblocks on floppy discs
  16336.  # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
  16337.  # AFS /usr/afsws/bin/install, which mishandles nonexistent args
  16338.  # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  16339.  # ./install, which can be erroneously created by make from ./install.sh.
  16340. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
  16341. -echo "configure:4447: checking for a BSD compatible install" >&5
  16342. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
  16343. +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
  16344.  if test -z "$INSTALL"; then
  16345. -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
  16346. -  echo $ac_n "(cached) $ac_c" 1>&6
  16347. +if test "${ac_cv_path_install+set}" = set; then
  16348. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16349.  else
  16350. -    IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS=":"
  16351. -  for ac_dir in $PATH; do
  16352. +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  16353. +for as_dir in $PATH
  16354. +do
  16355. +  IFS=$as_save_IFS
  16356. +  test -z "$as_dir" && as_dir=.
  16357.      # Account for people who put trailing slashes in PATH elements.
  16358. -    case "$ac_dir/" in
  16359. -    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
  16360. +case $as_dir/ in
  16361. +  ./ | .// | /cC/* | \
  16362. +  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
  16363. +  /usr/ucb/* ) ;;
  16364.      *)
  16365.        # OSF1 and SCO ODT 3.0 have their own names for install.
  16366.        # Don't use installbsd from OSF since it installs stuff as root
  16367.        # by default.
  16368.        for ac_prog in ginstall scoinst install; do
  16369. -        if test -f $ac_dir/$ac_prog; then
  16370. +      for ac_exec_ext in '' $ac_executable_extensions; do
  16371. +        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
  16372.        if test $ac_prog = install &&
  16373. -            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  16374. +            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
  16375.          # AIX install.  It has an incompatible calling convention.
  16376.          :
  16377. +          elif test $ac_prog = install &&
  16378. +            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
  16379. +            # program-specific install script used by HP pwplus--don't use.
  16380. +            :
  16381.        else
  16382. -        ac_cv_path_install="$ac_dir/$ac_prog -c"
  16383. -        break 2
  16384. +            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
  16385. +            break 3
  16386.        fi
  16387.      fi
  16388.        done
  16389. -      ;;
  16390. -    esac
  16391.    done
  16392. -  IFS="$ac_save_IFS"
  16393. +    ;;
  16394. +esac
  16395. +done
  16396. +
  16397.  
  16398.  fi
  16399.    if test "${ac_cv_path_install+set}" = set; then
  16400. -    INSTALL="$ac_cv_path_install"
  16401. +    INSTALL=$ac_cv_path_install
  16402.    else
  16403.      # As a last resort, use the slow shell script.  We don't cache a
  16404.      # path for INSTALL within a source directory, because that will
  16405.      # break other packages using the cache if that directory is
  16406.      # removed, or if the path is relative.
  16407. -    INSTALL="$ac_install_sh"
  16408. +    INSTALL=$ac_install_sh
  16409.    fi
  16410.  fi
  16411. -echo "$ac_t""$INSTALL" 1>&6
  16412. +echo "$as_me:$LINENO: result: $INSTALL" >&5
  16413. +echo "${ECHO_T}$INSTALL" >&6
  16414.  
  16415.  # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
  16416.  # It thinks the first close brace ends the variable substitution.
  16417.  test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
  16418.  
  16419. -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
  16420. +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
  16421.  
  16422.  test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
  16423.  
  16424. @@ -4525,10 +7787,10 @@
  16425.  if test "x$cross_compiling" = "xno"; then
  16426.    EXEEXT_FOR_BUILD='$(EXEEXT)'
  16427.  else
  16428. -  echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
  16429. -echo "configure:4530: checking for build system executable suffix" >&5
  16430. -if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
  16431. -  echo $ac_n "(cached) $ac_c" 1>&6
  16432. +  echo "$as_me:$LINENO: checking for build system executable suffix" >&5
  16433. +echo $ECHO_N "checking for build system executable suffix... $ECHO_C" >&6
  16434. +if test "${bfd_cv_build_exeext+set}" = set; then
  16435. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16436.  else
  16437.    rm -f conftest*
  16438.       echo 'int main () { return 0; }' > conftest.c
  16439. @@ -4543,125 +7805,357 @@
  16440.       rm -f conftest*
  16441.       test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
  16442.  fi
  16443. -
  16444. -echo "$ac_t""$bfd_cv_build_exeext" 1>&6
  16445. +echo "$as_me:$LINENO: result: $bfd_cv_build_exeext" >&5
  16446. +echo "${ECHO_T}$bfd_cv_build_exeext" >&6
  16447.    EXEEXT_FOR_BUILD=""
  16448.    test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
  16449.  fi
  16450.  
  16451.  
  16452. -for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h
  16453. +
  16454. +
  16455. +
  16456. +
  16457. +
  16458. +
  16459. +for ac_header in stddef.h string.h strings.h stdlib.h time.h unistd.h
  16460.  do
  16461. -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  16462. -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
  16463. -echo "configure:4558: checking for $ac_hdr" >&5
  16464. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  16465. -  echo $ac_n "(cached) $ac_c" 1>&6
  16466. -else
  16467. -  cat > conftest.$ac_ext <<EOF
  16468. -#line 4563 "configure"
  16469. -#include "confdefs.h"
  16470. -#include <$ac_hdr>
  16471. -EOF
  16472. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  16473. -{ (eval echo configure:4568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  16474. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  16475. -if test -z "$ac_err"; then
  16476. -  rm -rf conftest*
  16477. -  eval "ac_cv_header_$ac_safe=yes"
  16478. +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  16479. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  16480. +  echo "$as_me:$LINENO: checking for $ac_header" >&5
  16481. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  16482. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  16483. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16484. +fi
  16485. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  16486. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  16487. +else
  16488. +  # Is the header compilable?
  16489. +echo "$as_me:$LINENO: checking $ac_header usability" >&5
  16490. +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
  16491. +cat >conftest.$ac_ext <<_ACEOF
  16492. +#line $LINENO "configure"
  16493. +/* confdefs.h.  */
  16494. +_ACEOF
  16495. +cat confdefs.h >>conftest.$ac_ext
  16496. +cat >>conftest.$ac_ext <<_ACEOF
  16497. +/* end confdefs.h.  */
  16498. +$ac_includes_default
  16499. +#include <$ac_header>
  16500. +_ACEOF
  16501. +rm -f conftest.$ac_objext
  16502. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  16503. +  (eval $ac_compile) 2>&5
  16504. +  ac_status=$?
  16505. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16506. +  (exit $ac_status); } &&
  16507. +         { ac_try='test -s conftest.$ac_objext'
  16508. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  16509. +  (eval $ac_try) 2>&5
  16510. +  ac_status=$?
  16511. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16512. +  (exit $ac_status); }; }; then
  16513. +  ac_header_compiler=yes
  16514. +else
  16515. +  echo "$as_me: failed program was:" >&5
  16516. +sed 's/^/| /' conftest.$ac_ext >&5
  16517. +
  16518. +ac_header_compiler=no
  16519. +fi
  16520. +rm -f conftest.$ac_objext conftest.$ac_ext
  16521. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  16522. +echo "${ECHO_T}$ac_header_compiler" >&6
  16523. +
  16524. +# Is the header present?
  16525. +echo "$as_me:$LINENO: checking $ac_header presence" >&5
  16526. +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
  16527. +cat >conftest.$ac_ext <<_ACEOF
  16528. +#line $LINENO "configure"
  16529. +/* confdefs.h.  */
  16530. +_ACEOF
  16531. +cat confdefs.h >>conftest.$ac_ext
  16532. +cat >>conftest.$ac_ext <<_ACEOF
  16533. +/* end confdefs.h.  */
  16534. +#include <$ac_header>
  16535. +_ACEOF
  16536. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  16537. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  16538. +  ac_status=$?
  16539. +  grep -v '^ *+' conftest.er1 >conftest.err
  16540. +  rm -f conftest.er1
  16541. +  cat conftest.err >&5
  16542. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16543. +  (exit $ac_status); } >/dev/null; then
  16544. +  if test -s conftest.err; then
  16545. +    ac_cpp_err=$ac_c_preproc_warn_flag
  16546. +  else
  16547. +    ac_cpp_err=
  16548. +  fi
  16549. +else
  16550. +  ac_cpp_err=yes
  16551. +fi
  16552. +if test -z "$ac_cpp_err"; then
  16553. +  ac_header_preproc=yes
  16554. +else
  16555. +  echo "$as_me: failed program was:" >&5
  16556. +sed 's/^/| /' conftest.$ac_ext >&5
  16557. +
  16558. +  ac_header_preproc=no
  16559. +fi
  16560. +rm -f conftest.err conftest.$ac_ext
  16561. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  16562. +echo "${ECHO_T}$ac_header_preproc" >&6
  16563. +
  16564. +# So?  What about this header?
  16565. +case $ac_header_compiler:$ac_header_preproc in
  16566. +  yes:no )
  16567. +    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
  16568. +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
  16569. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  16570. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  16571. +    (
  16572. +      cat <<\_ASBOX
  16573. +## ------------------------------------ ##
  16574. +## Report this to bug-autoconf@gnu.org. ##
  16575. +## ------------------------------------ ##
  16576. +_ASBOX
  16577. +    ) |
  16578. +      sed "s/^/$as_me: WARNING:     /" >&2
  16579. +    ;;
  16580. +  no:yes )
  16581. +    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
  16582. +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
  16583. +    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
  16584. +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
  16585. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  16586. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  16587. +    (
  16588. +      cat <<\_ASBOX
  16589. +## ------------------------------------ ##
  16590. +## Report this to bug-autoconf@gnu.org. ##
  16591. +## ------------------------------------ ##
  16592. +_ASBOX
  16593. +    ) |
  16594. +      sed "s/^/$as_me: WARNING:     /" >&2
  16595. +    ;;
  16596. +esac
  16597. +echo "$as_me:$LINENO: checking for $ac_header" >&5
  16598. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  16599. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  16600. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16601.  else
  16602. -  echo "$ac_err" >&5
  16603. -  echo "configure: failed program was:" >&5
  16604. -  cat conftest.$ac_ext >&5
  16605. -  rm -rf conftest*
  16606. -  eval "ac_cv_header_$ac_safe=no"
  16607. +  eval "$as_ac_Header=$ac_header_preproc"
  16608.  fi
  16609. -rm -f conftest*
  16610. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  16611. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  16612. +
  16613.  fi
  16614. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  16615. -  echo "$ac_t""yes" 1>&6
  16616. -    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  16617. -  cat >> confdefs.h <<EOF
  16618. -#define $ac_tr_hdr 1
  16619. -EOF
  16620. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  16621. +  cat >>confdefs.h <<_ACEOF
  16622. +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  16623. +_ACEOF
  16624.   
  16625. -else
  16626. -  echo "$ac_t""no" 1>&6
  16627.  fi
  16628. +
  16629.  done
  16630.  
  16631. -for ac_hdr in fcntl.h sys/file.h sys/time.h
  16632. +
  16633. +
  16634. +
  16635. +for ac_header in fcntl.h sys/file.h sys/time.h
  16636.  do
  16637. -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  16638. -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
  16639. -echo "configure:4598: checking for $ac_hdr" >&5
  16640. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  16641. -  echo $ac_n "(cached) $ac_c" 1>&6
  16642. -else
  16643. -  cat > conftest.$ac_ext <<EOF
  16644. -#line 4603 "configure"
  16645. -#include "confdefs.h"
  16646. -#include <$ac_hdr>
  16647. -EOF
  16648. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  16649. -{ (eval echo configure:4608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  16650. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  16651. -if test -z "$ac_err"; then
  16652. -  rm -rf conftest*
  16653. -  eval "ac_cv_header_$ac_safe=yes"
  16654. +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  16655. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  16656. +  echo "$as_me:$LINENO: checking for $ac_header" >&5
  16657. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  16658. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  16659. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16660. +fi
  16661. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  16662. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  16663. +else
  16664. +  # Is the header compilable?
  16665. +echo "$as_me:$LINENO: checking $ac_header usability" >&5
  16666. +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
  16667. +cat >conftest.$ac_ext <<_ACEOF
  16668. +#line $LINENO "configure"
  16669. +/* confdefs.h.  */
  16670. +_ACEOF
  16671. +cat confdefs.h >>conftest.$ac_ext
  16672. +cat >>conftest.$ac_ext <<_ACEOF
  16673. +/* end confdefs.h.  */
  16674. +$ac_includes_default
  16675. +#include <$ac_header>
  16676. +_ACEOF
  16677. +rm -f conftest.$ac_objext
  16678. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  16679. +  (eval $ac_compile) 2>&5
  16680. +  ac_status=$?
  16681. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16682. +  (exit $ac_status); } &&
  16683. +         { ac_try='test -s conftest.$ac_objext'
  16684. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  16685. +  (eval $ac_try) 2>&5
  16686. +  ac_status=$?
  16687. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16688. +  (exit $ac_status); }; }; then
  16689. +  ac_header_compiler=yes
  16690. +else
  16691. +  echo "$as_me: failed program was:" >&5
  16692. +sed 's/^/| /' conftest.$ac_ext >&5
  16693. +
  16694. +ac_header_compiler=no
  16695. +fi
  16696. +rm -f conftest.$ac_objext conftest.$ac_ext
  16697. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  16698. +echo "${ECHO_T}$ac_header_compiler" >&6
  16699. +
  16700. +# Is the header present?
  16701. +echo "$as_me:$LINENO: checking $ac_header presence" >&5
  16702. +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
  16703. +cat >conftest.$ac_ext <<_ACEOF
  16704. +#line $LINENO "configure"
  16705. +/* confdefs.h.  */
  16706. +_ACEOF
  16707. +cat confdefs.h >>conftest.$ac_ext
  16708. +cat >>conftest.$ac_ext <<_ACEOF
  16709. +/* end confdefs.h.  */
  16710. +#include <$ac_header>
  16711. +_ACEOF
  16712. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  16713. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  16714. +  ac_status=$?
  16715. +  grep -v '^ *+' conftest.er1 >conftest.err
  16716. +  rm -f conftest.er1
  16717. +  cat conftest.err >&5
  16718. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16719. +  (exit $ac_status); } >/dev/null; then
  16720. +  if test -s conftest.err; then
  16721. +    ac_cpp_err=$ac_c_preproc_warn_flag
  16722. +  else
  16723. +    ac_cpp_err=
  16724. +  fi
  16725. +else
  16726. +  ac_cpp_err=yes
  16727. +fi
  16728. +if test -z "$ac_cpp_err"; then
  16729. +  ac_header_preproc=yes
  16730. +else
  16731. +  echo "$as_me: failed program was:" >&5
  16732. +sed 's/^/| /' conftest.$ac_ext >&5
  16733. +
  16734. +  ac_header_preproc=no
  16735. +fi
  16736. +rm -f conftest.err conftest.$ac_ext
  16737. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  16738. +echo "${ECHO_T}$ac_header_preproc" >&6
  16739. +
  16740. +# So?  What about this header?
  16741. +case $ac_header_compiler:$ac_header_preproc in
  16742. +  yes:no )
  16743. +    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
  16744. +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
  16745. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  16746. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  16747. +    (
  16748. +      cat <<\_ASBOX
  16749. +## ------------------------------------ ##
  16750. +## Report this to bug-autoconf@gnu.org. ##
  16751. +## ------------------------------------ ##
  16752. +_ASBOX
  16753. +    ) |
  16754. +      sed "s/^/$as_me: WARNING:     /" >&2
  16755. +    ;;
  16756. +  no:yes )
  16757. +    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
  16758. +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
  16759. +    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
  16760. +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
  16761. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  16762. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  16763. +    (
  16764. +      cat <<\_ASBOX
  16765. +## ------------------------------------ ##
  16766. +## Report this to bug-autoconf@gnu.org. ##
  16767. +## ------------------------------------ ##
  16768. +_ASBOX
  16769. +    ) |
  16770. +      sed "s/^/$as_me: WARNING:     /" >&2
  16771. +    ;;
  16772. +esac
  16773. +echo "$as_me:$LINENO: checking for $ac_header" >&5
  16774. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  16775. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  16776. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16777.  else
  16778. -  echo "$ac_err" >&5
  16779. -  echo "configure: failed program was:" >&5
  16780. -  cat conftest.$ac_ext >&5
  16781. -  rm -rf conftest*
  16782. -  eval "ac_cv_header_$ac_safe=no"
  16783. +  eval "$as_ac_Header=$ac_header_preproc"
  16784.  fi
  16785. -rm -f conftest*
  16786. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  16787. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  16788. +
  16789.  fi
  16790. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  16791. -  echo "$ac_t""yes" 1>&6
  16792. -    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  16793. -  cat >> confdefs.h <<EOF
  16794. -#define $ac_tr_hdr 1
  16795. -EOF
  16796. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  16797. +  cat >>confdefs.h <<_ACEOF
  16798. +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  16799. +_ACEOF
  16800.   
  16801. -else
  16802. -  echo "$ac_t""no" 1>&6
  16803.  fi
  16804. +
  16805.  done
  16806.  
  16807. -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
  16808. -echo "configure:4635: checking whether time.h and sys/time.h may both be included" >&5
  16809. -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
  16810. -  echo $ac_n "(cached) $ac_c" 1>&6
  16811. -else
  16812. -  cat > conftest.$ac_ext <<EOF
  16813. -#line 4640 "configure"
  16814. -#include "confdefs.h"
  16815. +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
  16816. +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
  16817. +if test "${ac_cv_header_time+set}" = set; then
  16818. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16819. +else
  16820. +  cat >conftest.$ac_ext <<_ACEOF
  16821. +#line $LINENO "configure"
  16822. +/* confdefs.h.  */
  16823. +_ACEOF
  16824. +cat confdefs.h >>conftest.$ac_ext
  16825. +cat >>conftest.$ac_ext <<_ACEOF
  16826. +/* end confdefs.h.  */
  16827.  #include <sys/types.h>
  16828.  #include <sys/time.h>
  16829.  #include <time.h>
  16830. -int main() {
  16831. -struct tm *tp;
  16832. -; return 0; }
  16833. -EOF
  16834. -if { (eval echo configure:4649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  16835. -  rm -rf conftest*
  16836. +
  16837. +int
  16838. +main ()
  16839. +{
  16840. +if ((struct tm *) 0)
  16841. +return 0;
  16842. +  ;
  16843. +  return 0;
  16844. +}
  16845. +_ACEOF
  16846. +rm -f conftest.$ac_objext
  16847. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  16848. +  (eval $ac_compile) 2>&5
  16849. +  ac_status=$?
  16850. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16851. +  (exit $ac_status); } &&
  16852. +         { ac_try='test -s conftest.$ac_objext'
  16853. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  16854. +  (eval $ac_try) 2>&5
  16855. +  ac_status=$?
  16856. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16857. +  (exit $ac_status); }; }; then
  16858.    ac_cv_header_time=yes
  16859.  else
  16860. -  echo "configure: failed program was:" >&5
  16861. -  cat conftest.$ac_ext >&5
  16862. -  rm -rf conftest*
  16863. -  ac_cv_header_time=no
  16864. +  echo "$as_me: failed program was:" >&5
  16865. +sed 's/^/| /' conftest.$ac_ext >&5
  16866. +
  16867. +ac_cv_header_time=no
  16868.  fi
  16869. -rm -f conftest*
  16870. +rm -f conftest.$ac_objext conftest.$ac_ext
  16871.  fi
  16872. -
  16873. -echo "$ac_t""$ac_cv_header_time" 1>&6
  16874. +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
  16875. +echo "${ECHO_T}$ac_cv_header_time" >&6
  16876.  if test $ac_cv_header_time = yes; then
  16877. -  cat >> confdefs.h <<\EOF
  16878. +
  16879. +cat >>confdefs.h <<\_ACEOF
  16880.  #define TIME_WITH_SYS_TIME 1
  16881. -EOF
  16882. +_ACEOF
  16883.  
  16884.  fi
  16885.  
  16886. @@ -4665,45 +8159,69 @@
  16887.  
  16888.  fi
  16889.  
  16890. +
  16891. +
  16892. +
  16893. +
  16894. +
  16895.  ac_header_dirent=no
  16896. -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
  16897. -do
  16898. -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  16899. -echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
  16900. -echo "configure:4674: checking for $ac_hdr that defines DIR" >&5
  16901. -if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
  16902. -  echo $ac_n "(cached) $ac_c" 1>&6
  16903. -else
  16904. -  cat > conftest.$ac_ext <<EOF
  16905. -#line 4679 "configure"
  16906. -#include "confdefs.h"
  16907. +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
  16908. +  as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
  16909. +echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
  16910. +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
  16911. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  16912. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  16913. +else
  16914. +  cat >conftest.$ac_ext <<_ACEOF
  16915. +#line $LINENO "configure"
  16916. +/* confdefs.h.  */
  16917. +_ACEOF
  16918. +cat confdefs.h >>conftest.$ac_ext
  16919. +cat >>conftest.$ac_ext <<_ACEOF
  16920. +/* end confdefs.h.  */
  16921.  #include <sys/types.h>
  16922.  #include <$ac_hdr>
  16923. -int main() {
  16924. -DIR *dirp = 0;
  16925. -; return 0; }
  16926. -EOF
  16927. -if { (eval echo configure:4687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  16928. -  rm -rf conftest*
  16929. -  eval "ac_cv_header_dirent_$ac_safe=yes"
  16930. -else
  16931. -  echo "configure: failed program was:" >&5
  16932. -  cat conftest.$ac_ext >&5
  16933. -  rm -rf conftest*
  16934. -  eval "ac_cv_header_dirent_$ac_safe=no"
  16935. -fi
  16936. -rm -f conftest*
  16937. -fi
  16938. -if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
  16939. -  echo "$ac_t""yes" 1>&6
  16940. -    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  16941. -  cat >> confdefs.h <<EOF
  16942. -#define $ac_tr_hdr 1
  16943. -EOF
  16944. - ac_header_dirent=$ac_hdr; break
  16945. -else
  16946. -  echo "$ac_t""no" 1>&6
  16947. +
  16948. +int
  16949. +main ()
  16950. +{
  16951. +if ((DIR *) 0)
  16952. +return 0;
  16953. +  ;
  16954. +  return 0;
  16955. +}
  16956. +_ACEOF
  16957. +rm -f conftest.$ac_objext
  16958. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  16959. +  (eval $ac_compile) 2>&5
  16960. +  ac_status=$?
  16961. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16962. +  (exit $ac_status); } &&
  16963. +         { ac_try='test -s conftest.$ac_objext'
  16964. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  16965. +  (eval $ac_try) 2>&5
  16966. +  ac_status=$?
  16967. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  16968. +  (exit $ac_status); }; }; then
  16969. +  eval "$as_ac_Header=yes"
  16970. +else
  16971. +  echo "$as_me: failed program was:" >&5
  16972. +sed 's/^/| /' conftest.$ac_ext >&5
  16973. +
  16974. +eval "$as_ac_Header=no"
  16975. +fi
  16976. +rm -f conftest.$ac_objext conftest.$ac_ext
  16977. +fi
  16978. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  16979. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  16980. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  16981. +  cat >>confdefs.h <<_ACEOF
  16982. +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
  16983. +_ACEOF
  16984. +
  16985. +ac_header_dirent=$ac_hdr; break
  16986.  fi
  16987. +
  16988.  done
  16989.  # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
  16990.  if test $ac_header_dirent = dirent.h; then
  16991. @@ -4707,85 +8225,217 @@
  16992.  done
  16993.  # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
  16994.  if test $ac_header_dirent = dirent.h; then
  16995. -echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
  16996. -echo "configure:4712: checking for opendir in -ldir" >&5
  16997. -ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
  16998. -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  16999. -  echo $ac_n "(cached) $ac_c" 1>&6
  17000. -else
  17001. -  ac_save_LIBS="$LIBS"
  17002. -LIBS="-ldir  $LIBS"
  17003. -cat > conftest.$ac_ext <<EOF
  17004. -#line 4720 "configure"
  17005. -#include "confdefs.h"
  17006. +  echo "$as_me:$LINENO: checking for library containing opendir" >&5
  17007. +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
  17008. +if test "${ac_cv_search_opendir+set}" = set; then
  17009. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17010. +else
  17011. +  ac_func_search_save_LIBS=$LIBS
  17012. +ac_cv_search_opendir=no
  17013. +cat >conftest.$ac_ext <<_ACEOF
  17014. +#line $LINENO "configure"
  17015. +/* confdefs.h.  */
  17016. +_ACEOF
  17017. +cat confdefs.h >>conftest.$ac_ext
  17018. +cat >>conftest.$ac_ext <<_ACEOF
  17019. +/* end confdefs.h.  */
  17020. +
  17021.  /* Override any gcc2 internal prototype to avoid an error.  */
  17022. +#ifdef __cplusplus
  17023. +extern "C"
  17024. +#endif
  17025.  /* We use char because int might match the return type of a gcc2
  17026.      builtin and then its argument prototype would still apply.  */
  17027. -char opendir();
  17028. +char opendir ();
  17029. +int
  17030. +main ()
  17031. +{
  17032. +opendir ();
  17033. +  ;
  17034. +  return 0;
  17035. +}
  17036. +_ACEOF
  17037. +rm -f conftest.$ac_objext conftest$ac_exeext
  17038. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  17039. +  (eval $ac_link) 2>&5
  17040. +  ac_status=$?
  17041. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17042. +  (exit $ac_status); } &&
  17043. +         { ac_try='test -s conftest$ac_exeext'
  17044. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17045. +  (eval $ac_try) 2>&5
  17046. +  ac_status=$?
  17047. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17048. +  (exit $ac_status); }; }; then
  17049. +  ac_cv_search_opendir="none required"
  17050. +else
  17051. +  echo "$as_me: failed program was:" >&5
  17052. +sed 's/^/| /' conftest.$ac_ext >&5
  17053. +
  17054. +fi
  17055. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  17056. +if test "$ac_cv_search_opendir" = no; then
  17057. +  for ac_lib in dir; do
  17058. +    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
  17059. +    cat >conftest.$ac_ext <<_ACEOF
  17060. +#line $LINENO "configure"
  17061. +/* confdefs.h.  */
  17062. +_ACEOF
  17063. +cat confdefs.h >>conftest.$ac_ext
  17064. +cat >>conftest.$ac_ext <<_ACEOF
  17065. +/* end confdefs.h.  */
  17066.  
  17067. -int main() {
  17068. -opendir()
  17069. -; return 0; }
  17070. -EOF
  17071. -if { (eval echo configure:4731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  17072. -  rm -rf conftest*
  17073. -  eval "ac_cv_lib_$ac_lib_var=yes"
  17074. +/* Override any gcc2 internal prototype to avoid an error.  */
  17075. +#ifdef __cplusplus
  17076. +extern "C"
  17077. +#endif
  17078. +/* We use char because int might match the return type of a gcc2
  17079. +   builtin and then its argument prototype would still apply.  */
  17080. +char opendir ();
  17081. +int
  17082. +main ()
  17083. +{
  17084. +opendir ();
  17085. +  ;
  17086. +  return 0;
  17087. +}
  17088. +_ACEOF
  17089. +rm -f conftest.$ac_objext conftest$ac_exeext
  17090. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  17091. +  (eval $ac_link) 2>&5
  17092. +  ac_status=$?
  17093. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17094. +  (exit $ac_status); } &&
  17095. +         { ac_try='test -s conftest$ac_exeext'
  17096. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17097. +  (eval $ac_try) 2>&5
  17098. +  ac_status=$?
  17099. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17100. +  (exit $ac_status); }; }; then
  17101. +  ac_cv_search_opendir="-l$ac_lib"
  17102. +break
  17103.  else
  17104. -  echo "configure: failed program was:" >&5
  17105. -  cat conftest.$ac_ext >&5
  17106. -  rm -rf conftest*
  17107. -  eval "ac_cv_lib_$ac_lib_var=no"
  17108. -fi
  17109. -rm -f conftest*
  17110. -LIBS="$ac_save_LIBS"
  17111. +  echo "$as_me: failed program was:" >&5
  17112. +sed 's/^/| /' conftest.$ac_ext >&5
  17113.  
  17114.  fi
  17115. -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  17116. -  echo "$ac_t""yes" 1>&6
  17117. -  LIBS="$LIBS -ldir"
  17118. -else
  17119. -  echo "$ac_t""no" 1>&6
  17120. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  17121. +  done
  17122. +fi
  17123. +LIBS=$ac_func_search_save_LIBS
  17124. +fi
  17125. +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
  17126. +echo "${ECHO_T}$ac_cv_search_opendir" >&6
  17127. +if test "$ac_cv_search_opendir" != no; then
  17128. +  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
  17129. +
  17130.  fi
  17131.  
  17132.  else
  17133. -echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
  17134. -echo "configure:4753: checking for opendir in -lx" >&5
  17135. -ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
  17136. -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  17137. -  echo $ac_n "(cached) $ac_c" 1>&6
  17138. -else
  17139. -  ac_save_LIBS="$LIBS"
  17140. -LIBS="-lx  $LIBS"
  17141. -cat > conftest.$ac_ext <<EOF
  17142. -#line 4761 "configure"
  17143. -#include "confdefs.h"
  17144. +  echo "$as_me:$LINENO: checking for library containing opendir" >&5
  17145. +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
  17146. +if test "${ac_cv_search_opendir+set}" = set; then
  17147. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17148. +else
  17149. +  ac_func_search_save_LIBS=$LIBS
  17150. +ac_cv_search_opendir=no
  17151. +cat >conftest.$ac_ext <<_ACEOF
  17152. +#line $LINENO "configure"
  17153. +/* confdefs.h.  */
  17154. +_ACEOF
  17155. +cat confdefs.h >>conftest.$ac_ext
  17156. +cat >>conftest.$ac_ext <<_ACEOF
  17157. +/* end confdefs.h.  */
  17158. +
  17159.  /* Override any gcc2 internal prototype to avoid an error.  */
  17160. +#ifdef __cplusplus
  17161. +extern "C"
  17162. +#endif
  17163.  /* We use char because int might match the return type of a gcc2
  17164.      builtin and then its argument prototype would still apply.  */
  17165. -char opendir();
  17166. +char opendir ();
  17167. +int
  17168. +main ()
  17169. +{
  17170. +opendir ();
  17171. +  ;
  17172. +  return 0;
  17173. +}
  17174. +_ACEOF
  17175. +rm -f conftest.$ac_objext conftest$ac_exeext
  17176. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  17177. +  (eval $ac_link) 2>&5
  17178. +  ac_status=$?
  17179. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17180. +  (exit $ac_status); } &&
  17181. +         { ac_try='test -s conftest$ac_exeext'
  17182. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17183. +  (eval $ac_try) 2>&5
  17184. +  ac_status=$?
  17185. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17186. +  (exit $ac_status); }; }; then
  17187. +  ac_cv_search_opendir="none required"
  17188. +else
  17189. +  echo "$as_me: failed program was:" >&5
  17190. +sed 's/^/| /' conftest.$ac_ext >&5
  17191. +
  17192. +fi
  17193. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  17194. +if test "$ac_cv_search_opendir" = no; then
  17195. +  for ac_lib in x; do
  17196. +    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
  17197. +    cat >conftest.$ac_ext <<_ACEOF
  17198. +#line $LINENO "configure"
  17199. +/* confdefs.h.  */
  17200. +_ACEOF
  17201. +cat confdefs.h >>conftest.$ac_ext
  17202. +cat >>conftest.$ac_ext <<_ACEOF
  17203. +/* end confdefs.h.  */
  17204.  
  17205. -int main() {
  17206. -opendir()
  17207. -; return 0; }
  17208. -EOF
  17209. -if { (eval echo configure:4772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  17210. -  rm -rf conftest*
  17211. -  eval "ac_cv_lib_$ac_lib_var=yes"
  17212. +/* Override any gcc2 internal prototype to avoid an error.  */
  17213. +#ifdef __cplusplus
  17214. +extern "C"
  17215. +#endif
  17216. +/* We use char because int might match the return type of a gcc2
  17217. +   builtin and then its argument prototype would still apply.  */
  17218. +char opendir ();
  17219. +int
  17220. +main ()
  17221. +{
  17222. +opendir ();
  17223. +  ;
  17224. +  return 0;
  17225. +}
  17226. +_ACEOF
  17227. +rm -f conftest.$ac_objext conftest$ac_exeext
  17228. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  17229. +  (eval $ac_link) 2>&5
  17230. +  ac_status=$?
  17231. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17232. +  (exit $ac_status); } &&
  17233. +         { ac_try='test -s conftest$ac_exeext'
  17234. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17235. +  (eval $ac_try) 2>&5
  17236. +  ac_status=$?
  17237. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17238. +  (exit $ac_status); }; }; then
  17239. +  ac_cv_search_opendir="-l$ac_lib"
  17240. +break
  17241.  else
  17242. -  echo "configure: failed program was:" >&5
  17243. -  cat conftest.$ac_ext >&5
  17244. -  rm -rf conftest*
  17245. -  eval "ac_cv_lib_$ac_lib_var=no"
  17246. -fi
  17247. -rm -f conftest*
  17248. -LIBS="$ac_save_LIBS"
  17249. +  echo "$as_me: failed program was:" >&5
  17250. +sed 's/^/| /' conftest.$ac_ext >&5
  17251.  
  17252.  fi
  17253. -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  17254. -  echo "$ac_t""yes" 1>&6
  17255. -  LIBS="$LIBS -lx"
  17256. -else
  17257. -  echo "$ac_t""no" 1>&6
  17258. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  17259. +  done
  17260. +fi
  17261. +LIBS=$ac_func_search_save_LIBS
  17262. +fi
  17263. +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
  17264. +echo "${ECHO_T}$ac_cv_search_opendir" >&6
  17265. +if test "$ac_cv_search_opendir" != no; then
  17266. +  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
  17267. +
  17268.  fi
  17269.  
  17270.  fi
  17271. @@ -4790,58 +8440,93 @@
  17272.  
  17273.  fi
  17274.  
  17275. +
  17276. +
  17277. +
  17278. +
  17279. +
  17280. +
  17281. +
  17282.  for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid
  17283.  do
  17284. -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  17285. -echo "configure:4797: checking for $ac_func" >&5
  17286. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  17287. -  echo $ac_n "(cached) $ac_c" 1>&6
  17288. -else
  17289. -  cat > conftest.$ac_ext <<EOF
  17290. -#line 4802 "configure"
  17291. -#include "confdefs.h"
  17292. +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  17293. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  17294. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  17295. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  17296. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17297. +else
  17298. +  cat >conftest.$ac_ext <<_ACEOF
  17299. +#line $LINENO "configure"
  17300. +/* confdefs.h.  */
  17301. +_ACEOF
  17302. +cat confdefs.h >>conftest.$ac_ext
  17303. +cat >>conftest.$ac_ext <<_ACEOF
  17304. +/* end confdefs.h.  */
  17305.  /* System header to define __stub macros and hopefully few prototypes,
  17306. -    which can conflict with char $ac_func(); below.  */
  17307. -#include <assert.h>
  17308. +    which can conflict with char $ac_func (); below.
  17309. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  17310. +    <limits.h> exists even on freestanding compilers.  */
  17311. +#ifdef __STDC__
  17312. +# include <limits.h>
  17313. +#else
  17314. +# include <assert.h>
  17315. +#endif
  17316.  /* Override any gcc2 internal prototype to avoid an error.  */
  17317. +#ifdef __cplusplus
  17318. +extern "C"
  17319. +{
  17320. +#endif
  17321.  /* We use char because int might match the return type of a gcc2
  17322.      builtin and then its argument prototype would still apply.  */
  17323. -char $ac_func();
  17324. -
  17325. -int main() {
  17326. -
  17327. +char $ac_func ();
  17328.  /* The GNU C library defines this for functions which it implements
  17329.      to always fail with ENOSYS.  Some functions are actually named
  17330.      something starting with __ and the normal name is an alias.  */
  17331.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  17332.  choke me
  17333.  #else
  17334. -$ac_func();
  17335. +char (*f) () = $ac_func;
  17336. +#endif
  17337. +#ifdef __cplusplus
  17338. +}
  17339.  #endif
  17340.  
  17341. -; return 0; }
  17342. -EOF
  17343. -if { (eval echo configure:4825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  17344. -  rm -rf conftest*
  17345. -  eval "ac_cv_func_$ac_func=yes"
  17346. -else
  17347. -  echo "configure: failed program was:" >&5
  17348. -  cat conftest.$ac_ext >&5
  17349. -  rm -rf conftest*
  17350. -  eval "ac_cv_func_$ac_func=no"
  17351. -fi
  17352. -rm -f conftest*
  17353. -fi
  17354. -
  17355. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  17356. -  echo "$ac_t""yes" 1>&6
  17357. -    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  17358. -  cat >> confdefs.h <<EOF
  17359. -#define $ac_tr_func 1
  17360. -EOF
  17361. +int
  17362. +main ()
  17363. +{
  17364. +return f != $ac_func;
  17365. +  ;
  17366. +  return 0;
  17367. +}
  17368. +_ACEOF
  17369. +rm -f conftest.$ac_objext conftest$ac_exeext
  17370. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  17371. +  (eval $ac_link) 2>&5
  17372. +  ac_status=$?
  17373. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17374. +  (exit $ac_status); } &&
  17375. +         { ac_try='test -s conftest$ac_exeext'
  17376. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17377. +  (eval $ac_try) 2>&5
  17378. +  ac_status=$?
  17379. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17380. +  (exit $ac_status); }; }; then
  17381. +  eval "$as_ac_var=yes"
  17382. +else
  17383. +  echo "$as_me: failed program was:" >&5
  17384. +sed 's/^/| /' conftest.$ac_ext >&5
  17385. +
  17386. +eval "$as_ac_var=no"
  17387. +fi
  17388. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  17389. +fi
  17390. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  17391. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  17392. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  17393. +  cat >>confdefs.h <<_ACEOF
  17394. +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  17395. +_ACEOF
  17396.   
  17397. -else
  17398. -  echo "$ac_t""no" 1>&6
  17399.  fi
  17400.  done
  17401.  
  17402. @@ -4849,20 +8534,25 @@
  17403.  
  17404.  case "${host}" in
  17405.  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
  17406. -  cat >> confdefs.h <<\EOF
  17407. +
  17408. +cat >>confdefs.h <<\_ACEOF
  17409.  #define USE_BINARY_FOPEN 1
  17410. -EOF
  17411. +_ACEOF
  17412.   ;;
  17413.  esac
  17414.  
  17415. -echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
  17416. -echo "configure:4860: checking whether strstr must be declared" >&5
  17417. -if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
  17418. -  echo $ac_n "(cached) $ac_c" 1>&6
  17419. -else
  17420. -  cat > conftest.$ac_ext <<EOF
  17421. -#line 4865 "configure"
  17422. -#include "confdefs.h"
  17423. +echo "$as_me:$LINENO: checking whether strstr must be declared" >&5
  17424. +echo $ECHO_N "checking whether strstr must be declared... $ECHO_C" >&6
  17425. +if test "${bfd_cv_decl_needed_strstr+set}" = set; then
  17426. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17427. +else
  17428. +  cat >conftest.$ac_ext <<_ACEOF
  17429. +#line $LINENO "configure"
  17430. +/* confdefs.h.  */
  17431. +_ACEOF
  17432. +cat confdefs.h >>conftest.$ac_ext
  17433. +cat >>conftest.$ac_ext <<_ACEOF
  17434. +/* end confdefs.h.  */
  17435.  
  17436.  #include <stdio.h>
  17437.  #ifdef HAVE_STRING_H
  17438. @@ -4878,38 +8568,58 @@
  17439.  #ifdef HAVE_UNISTD_H
  17440.  #include <unistd.h>
  17441.  #endif
  17442. -int main() {
  17443. +int
  17444. +main ()
  17445. +{
  17446.  char *(*pfn) = (char *(*)) strstr
  17447. -; return 0; }
  17448. -EOF
  17449. -if { (eval echo configure:4886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  17450. -  rm -rf conftest*
  17451. +  ;
  17452. +  return 0;
  17453. +}
  17454. +_ACEOF
  17455. +rm -f conftest.$ac_objext
  17456. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  17457. +  (eval $ac_compile) 2>&5
  17458. +  ac_status=$?
  17459. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17460. +  (exit $ac_status); } &&
  17461. +         { ac_try='test -s conftest.$ac_objext'
  17462. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17463. +  (eval $ac_try) 2>&5
  17464. +  ac_status=$?
  17465. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17466. +  (exit $ac_status); }; }; then
  17467.    bfd_cv_decl_needed_strstr=no
  17468.  else
  17469. -  echo "configure: failed program was:" >&5
  17470. -  cat conftest.$ac_ext >&5
  17471. -  rm -rf conftest*
  17472. -  bfd_cv_decl_needed_strstr=yes
  17473. +  echo "$as_me: failed program was:" >&5
  17474. +sed 's/^/| /' conftest.$ac_ext >&5
  17475. +
  17476. +bfd_cv_decl_needed_strstr=yes
  17477.  fi
  17478. -rm -f conftest*
  17479. +rm -f conftest.$ac_objext conftest.$ac_ext
  17480.  fi
  17481.  
  17482. -echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6
  17483. +echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_strstr" >&5
  17484. +echo "${ECHO_T}$bfd_cv_decl_needed_strstr" >&6
  17485.  if test $bfd_cv_decl_needed_strstr = yes; then
  17486. -  cat >> confdefs.h <<\EOF
  17487. +
  17488. +cat >>confdefs.h <<\_ACEOF
  17489.  #define NEED_DECLARATION_STRSTR 1
  17490. -EOF
  17491. +_ACEOF
  17492.  
  17493.  fi
  17494.  
  17495. -echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
  17496. -echo "configure:4907: checking whether malloc must be declared" >&5
  17497. -if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
  17498. -  echo $ac_n "(cached) $ac_c" 1>&6
  17499. -else
  17500. -  cat > conftest.$ac_ext <<EOF
  17501. -#line 4912 "configure"
  17502. -#include "confdefs.h"
  17503. +echo "$as_me:$LINENO: checking whether malloc must be declared" >&5
  17504. +echo $ECHO_N "checking whether malloc must be declared... $ECHO_C" >&6
  17505. +if test "${bfd_cv_decl_needed_malloc+set}" = set; then
  17506. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17507. +else
  17508. +  cat >conftest.$ac_ext <<_ACEOF
  17509. +#line $LINENO "configure"
  17510. +/* confdefs.h.  */
  17511. +_ACEOF
  17512. +cat confdefs.h >>conftest.$ac_ext
  17513. +cat >>conftest.$ac_ext <<_ACEOF
  17514. +/* end confdefs.h.  */
  17515.  
  17516.  #include <stdio.h>
  17517.  #ifdef HAVE_STRING_H
  17518. @@ -4925,38 +8635,58 @@
  17519.  #ifdef HAVE_UNISTD_H
  17520.  #include <unistd.h>
  17521.  #endif
  17522. -int main() {
  17523. +int
  17524. +main ()
  17525. +{
  17526.  char *(*pfn) = (char *(*)) malloc
  17527. -; return 0; }
  17528. -EOF
  17529. -if { (eval echo configure:4933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  17530. -  rm -rf conftest*
  17531. +  ;
  17532. +  return 0;
  17533. +}
  17534. +_ACEOF
  17535. +rm -f conftest.$ac_objext
  17536. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  17537. +  (eval $ac_compile) 2>&5
  17538. +  ac_status=$?
  17539. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17540. +  (exit $ac_status); } &&
  17541. +         { ac_try='test -s conftest.$ac_objext'
  17542. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17543. +  (eval $ac_try) 2>&5
  17544. +  ac_status=$?
  17545. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17546. +  (exit $ac_status); }; }; then
  17547.    bfd_cv_decl_needed_malloc=no
  17548.  else
  17549. -  echo "configure: failed program was:" >&5
  17550. -  cat conftest.$ac_ext >&5
  17551. -  rm -rf conftest*
  17552. -  bfd_cv_decl_needed_malloc=yes
  17553. +  echo "$as_me: failed program was:" >&5
  17554. +sed 's/^/| /' conftest.$ac_ext >&5
  17555. +
  17556. +bfd_cv_decl_needed_malloc=yes
  17557.  fi
  17558. -rm -f conftest*
  17559. +rm -f conftest.$ac_objext conftest.$ac_ext
  17560.  fi
  17561.  
  17562. -echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6
  17563. +echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_malloc" >&5
  17564. +echo "${ECHO_T}$bfd_cv_decl_needed_malloc" >&6
  17565.  if test $bfd_cv_decl_needed_malloc = yes; then
  17566. -  cat >> confdefs.h <<\EOF
  17567. +
  17568. +cat >>confdefs.h <<\_ACEOF
  17569.  #define NEED_DECLARATION_MALLOC 1
  17570. -EOF
  17571. +_ACEOF
  17572.  
  17573.  fi
  17574.  
  17575. -echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
  17576. -echo "configure:4954: checking whether realloc must be declared" >&5
  17577. -if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
  17578. -  echo $ac_n "(cached) $ac_c" 1>&6
  17579. -else
  17580. -  cat > conftest.$ac_ext <<EOF
  17581. -#line 4959 "configure"
  17582. -#include "confdefs.h"
  17583. +echo "$as_me:$LINENO: checking whether realloc must be declared" >&5
  17584. +echo $ECHO_N "checking whether realloc must be declared... $ECHO_C" >&6
  17585. +if test "${bfd_cv_decl_needed_realloc+set}" = set; then
  17586. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17587. +else
  17588. +  cat >conftest.$ac_ext <<_ACEOF
  17589. +#line $LINENO "configure"
  17590. +/* confdefs.h.  */
  17591. +_ACEOF
  17592. +cat confdefs.h >>conftest.$ac_ext
  17593. +cat >>conftest.$ac_ext <<_ACEOF
  17594. +/* end confdefs.h.  */
  17595.  
  17596.  #include <stdio.h>
  17597.  #ifdef HAVE_STRING_H
  17598. @@ -4972,38 +8702,58 @@
  17599.  #ifdef HAVE_UNISTD_H
  17600.  #include <unistd.h>
  17601.  #endif
  17602. -int main() {
  17603. +int
  17604. +main ()
  17605. +{
  17606.  char *(*pfn) = (char *(*)) realloc
  17607. -; return 0; }
  17608. -EOF
  17609. -if { (eval echo configure:4980: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  17610. -  rm -rf conftest*
  17611. +  ;
  17612. +  return 0;
  17613. +}
  17614. +_ACEOF
  17615. +rm -f conftest.$ac_objext
  17616. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  17617. +  (eval $ac_compile) 2>&5
  17618. +  ac_status=$?
  17619. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17620. +  (exit $ac_status); } &&
  17621. +         { ac_try='test -s conftest.$ac_objext'
  17622. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17623. +  (eval $ac_try) 2>&5
  17624. +  ac_status=$?
  17625. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17626. +  (exit $ac_status); }; }; then
  17627.    bfd_cv_decl_needed_realloc=no
  17628.  else
  17629. -  echo "configure: failed program was:" >&5
  17630. -  cat conftest.$ac_ext >&5
  17631. -  rm -rf conftest*
  17632. -  bfd_cv_decl_needed_realloc=yes
  17633. +  echo "$as_me: failed program was:" >&5
  17634. +sed 's/^/| /' conftest.$ac_ext >&5
  17635. +
  17636. +bfd_cv_decl_needed_realloc=yes
  17637.  fi
  17638. -rm -f conftest*
  17639. +rm -f conftest.$ac_objext conftest.$ac_ext
  17640.  fi
  17641.  
  17642. -echo "$ac_t""$bfd_cv_decl_needed_realloc" 1>&6
  17643. +echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_realloc" >&5
  17644. +echo "${ECHO_T}$bfd_cv_decl_needed_realloc" >&6
  17645.  if test $bfd_cv_decl_needed_realloc = yes; then
  17646. -  cat >> confdefs.h <<\EOF
  17647. +
  17648. +cat >>confdefs.h <<\_ACEOF
  17649.  #define NEED_DECLARATION_REALLOC 1
  17650. -EOF
  17651. +_ACEOF
  17652.  
  17653.  fi
  17654.  
  17655. -echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
  17656. -echo "configure:5001: checking whether free must be declared" >&5
  17657. -if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
  17658. -  echo $ac_n "(cached) $ac_c" 1>&6
  17659. -else
  17660. -  cat > conftest.$ac_ext <<EOF
  17661. -#line 5006 "configure"
  17662. -#include "confdefs.h"
  17663. +echo "$as_me:$LINENO: checking whether free must be declared" >&5
  17664. +echo $ECHO_N "checking whether free must be declared... $ECHO_C" >&6
  17665. +if test "${bfd_cv_decl_needed_free+set}" = set; then
  17666. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17667. +else
  17668. +  cat >conftest.$ac_ext <<_ACEOF
  17669. +#line $LINENO "configure"
  17670. +/* confdefs.h.  */
  17671. +_ACEOF
  17672. +cat confdefs.h >>conftest.$ac_ext
  17673. +cat >>conftest.$ac_ext <<_ACEOF
  17674. +/* end confdefs.h.  */
  17675.  
  17676.  #include <stdio.h>
  17677.  #ifdef HAVE_STRING_H
  17678. @@ -5019,38 +8769,58 @@
  17679.  #ifdef HAVE_UNISTD_H
  17680.  #include <unistd.h>
  17681.  #endif
  17682. -int main() {
  17683. +int
  17684. +main ()
  17685. +{
  17686.  char *(*pfn) = (char *(*)) free
  17687. -; return 0; }
  17688. -EOF
  17689. -if { (eval echo configure:5027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  17690. -  rm -rf conftest*
  17691. +  ;
  17692. +  return 0;
  17693. +}
  17694. +_ACEOF
  17695. +rm -f conftest.$ac_objext
  17696. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  17697. +  (eval $ac_compile) 2>&5
  17698. +  ac_status=$?
  17699. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17700. +  (exit $ac_status); } &&
  17701. +         { ac_try='test -s conftest.$ac_objext'
  17702. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17703. +  (eval $ac_try) 2>&5
  17704. +  ac_status=$?
  17705. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17706. +  (exit $ac_status); }; }; then
  17707.    bfd_cv_decl_needed_free=no
  17708.  else
  17709. -  echo "configure: failed program was:" >&5
  17710. -  cat conftest.$ac_ext >&5
  17711. -  rm -rf conftest*
  17712. -  bfd_cv_decl_needed_free=yes
  17713. +  echo "$as_me: failed program was:" >&5
  17714. +sed 's/^/| /' conftest.$ac_ext >&5
  17715. +
  17716. +bfd_cv_decl_needed_free=yes
  17717.  fi
  17718. -rm -f conftest*
  17719. +rm -f conftest.$ac_objext conftest.$ac_ext
  17720.  fi
  17721.  
  17722. -echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6
  17723. +echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_free" >&5
  17724. +echo "${ECHO_T}$bfd_cv_decl_needed_free" >&6
  17725.  if test $bfd_cv_decl_needed_free = yes; then
  17726. -  cat >> confdefs.h <<\EOF
  17727. +
  17728. +cat >>confdefs.h <<\_ACEOF
  17729.  #define NEED_DECLARATION_FREE 1
  17730. -EOF
  17731. +_ACEOF
  17732.  
  17733.  fi
  17734.  
  17735. -echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
  17736. -echo "configure:5048: checking whether getenv must be declared" >&5
  17737. -if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
  17738. -  echo $ac_n "(cached) $ac_c" 1>&6
  17739. -else
  17740. -  cat > conftest.$ac_ext <<EOF
  17741. -#line 5053 "configure"
  17742. -#include "confdefs.h"
  17743. +echo "$as_me:$LINENO: checking whether getenv must be declared" >&5
  17744. +echo $ECHO_N "checking whether getenv must be declared... $ECHO_C" >&6
  17745. +if test "${bfd_cv_decl_needed_getenv+set}" = set; then
  17746. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17747. +else
  17748. +  cat >conftest.$ac_ext <<_ACEOF
  17749. +#line $LINENO "configure"
  17750. +/* confdefs.h.  */
  17751. +_ACEOF
  17752. +cat confdefs.h >>conftest.$ac_ext
  17753. +cat >>conftest.$ac_ext <<_ACEOF
  17754. +/* end confdefs.h.  */
  17755.  
  17756.  #include <stdio.h>
  17757.  #ifdef HAVE_STRING_H
  17758. @@ -5066,27 +8836,43 @@
  17759.  #ifdef HAVE_UNISTD_H
  17760.  #include <unistd.h>
  17761.  #endif
  17762. -int main() {
  17763. +int
  17764. +main ()
  17765. +{
  17766.  char *(*pfn) = (char *(*)) getenv
  17767. -; return 0; }
  17768. -EOF
  17769. -if { (eval echo configure:5074: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  17770. -  rm -rf conftest*
  17771. +  ;
  17772. +  return 0;
  17773. +}
  17774. +_ACEOF
  17775. +rm -f conftest.$ac_objext
  17776. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  17777. +  (eval $ac_compile) 2>&5
  17778. +  ac_status=$?
  17779. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17780. +  (exit $ac_status); } &&
  17781. +         { ac_try='test -s conftest.$ac_objext'
  17782. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17783. +  (eval $ac_try) 2>&5
  17784. +  ac_status=$?
  17785. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17786. +  (exit $ac_status); }; }; then
  17787.    bfd_cv_decl_needed_getenv=no
  17788.  else
  17789. -  echo "configure: failed program was:" >&5
  17790. -  cat conftest.$ac_ext >&5
  17791. -  rm -rf conftest*
  17792. -  bfd_cv_decl_needed_getenv=yes
  17793. +  echo "$as_me: failed program was:" >&5
  17794. +sed 's/^/| /' conftest.$ac_ext >&5
  17795. +
  17796. +bfd_cv_decl_needed_getenv=yes
  17797.  fi
  17798. -rm -f conftest*
  17799. +rm -f conftest.$ac_objext conftest.$ac_ext
  17800.  fi
  17801.  
  17802. -echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6
  17803. +echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_getenv" >&5
  17804. +echo "${ECHO_T}$bfd_cv_decl_needed_getenv" >&6
  17805.  if test $bfd_cv_decl_needed_getenv = yes; then
  17806. -  cat >> confdefs.h <<\EOF
  17807. +
  17808. +cat >>confdefs.h <<\_ACEOF
  17809.  #define NEED_DECLARATION_GETENV 1
  17810. -EOF
  17811. +_ACEOF
  17812.  
  17813.  fi
  17814.  
  17815. @@ -5256,30 +9042,51 @@
  17816.      COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE"
  17817.      # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE
  17818.      # have c_impl as a member of struct core_dumpx
  17819. -    echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6
  17820. -echo "configure:5261: checking for c_impl in struct core_dumpx" >&5
  17821. -    cat > conftest.$ac_ext <<EOF
  17822. -#line 5263 "configure"
  17823. -#include "confdefs.h"
  17824. +    echo "$as_me:$LINENO: checking for c_impl in struct core_dumpx" >&5
  17825. +echo $ECHO_N "checking for c_impl in struct core_dumpx... $ECHO_C" >&6
  17826. +    cat >conftest.$ac_ext <<_ACEOF
  17827. +#line $LINENO "configure"
  17828. +/* confdefs.h.  */
  17829. +_ACEOF
  17830. +cat confdefs.h >>conftest.$ac_ext
  17831. +cat >>conftest.$ac_ext <<_ACEOF
  17832. +/* end confdefs.h.  */
  17833.  #include <core.h>
  17834. -int main() {
  17835. +int
  17836. +main ()
  17837. +{
  17838.  struct core_dumpx c; c.c_impl = 0;
  17839. -; return 0; }
  17840. -EOF
  17841. -if { (eval echo configure:5270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  17842. -  rm -rf conftest*
  17843. -  cat >> confdefs.h <<\EOF
  17844. +  ;
  17845. +  return 0;
  17846. +}
  17847. +_ACEOF
  17848. +rm -f conftest.$ac_objext
  17849. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  17850. +  (eval $ac_compile) 2>&5
  17851. +  ac_status=$?
  17852. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17853. +  (exit $ac_status); } &&
  17854. +         { ac_try='test -s conftest.$ac_objext'
  17855. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17856. +  (eval $ac_try) 2>&5
  17857. +  ac_status=$?
  17858. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17859. +  (exit $ac_status); }; }; then
  17860. +
  17861. +cat >>confdefs.h <<\_ACEOF
  17862.  #define HAVE_ST_C_IMPL 1
  17863. -EOF
  17864. +_ACEOF
  17865.  
  17866. -      echo "$ac_t""yes" 1>&6
  17867. +      echo "$as_me:$LINENO: result: yes" >&5
  17868. +echo "${ECHO_T}yes" >&6
  17869.  else
  17870. -  echo "configure: failed program was:" >&5
  17871. -  cat conftest.$ac_ext >&5
  17872. -  rm -rf conftest*
  17873. -  echo "$ac_t""no" 1>&6
  17874. +  echo "$as_me: failed program was:" >&5
  17875. +sed 's/^/| /' conftest.$ac_ext >&5
  17876. +
  17877. +echo "$as_me:$LINENO: result: no" >&5
  17878. +echo "${ECHO_T}no" >&6
  17879.  fi
  17880. -rm -f conftest*
  17881. +rm -f conftest.$ac_objext conftest.$ac_ext
  17882.      ;;
  17883.    rs6000-*-aix4*)    COREFILE=rs6000-core.lo ;;
  17884.    rs6000-*-*)        COREFILE=rs6000-core.lo ;;
  17885. @@ -5330,44 +9137,146 @@
  17886.  
  17887.    # ELF corefile support has several flavors, but all of
  17888.    # them use something called <sys/procfs.h>
  17889. -  for ac_hdr in sys/procfs.h
  17890. +
  17891. +for ac_header in sys/procfs.h
  17892.  do
  17893. -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  17894. -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
  17895. -echo "configure:5338: checking for $ac_hdr" >&5
  17896. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  17897. -  echo $ac_n "(cached) $ac_c" 1>&6
  17898. -else
  17899. -  cat > conftest.$ac_ext <<EOF
  17900. -#line 5343 "configure"
  17901. -#include "confdefs.h"
  17902. -#include <$ac_hdr>
  17903. -EOF
  17904. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  17905. -{ (eval echo configure:5348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  17906. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  17907. -if test -z "$ac_err"; then
  17908. -  rm -rf conftest*
  17909. -  eval "ac_cv_header_$ac_safe=yes"
  17910. +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  17911. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  17912. +  echo "$as_me:$LINENO: checking for $ac_header" >&5
  17913. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  17914. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  17915. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  17916. +fi
  17917. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  17918. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  17919. +else
  17920. +  # Is the header compilable?
  17921. +echo "$as_me:$LINENO: checking $ac_header usability" >&5
  17922. +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
  17923. +cat >conftest.$ac_ext <<_ACEOF
  17924. +#line $LINENO "configure"
  17925. +/* confdefs.h.  */
  17926. +_ACEOF
  17927. +cat confdefs.h >>conftest.$ac_ext
  17928. +cat >>conftest.$ac_ext <<_ACEOF
  17929. +/* end confdefs.h.  */
  17930. +$ac_includes_default
  17931. +#include <$ac_header>
  17932. +_ACEOF
  17933. +rm -f conftest.$ac_objext
  17934. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  17935. +  (eval $ac_compile) 2>&5
  17936. +  ac_status=$?
  17937. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17938. +  (exit $ac_status); } &&
  17939. +         { ac_try='test -s conftest.$ac_objext'
  17940. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  17941. +  (eval $ac_try) 2>&5
  17942. +  ac_status=$?
  17943. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17944. +  (exit $ac_status); }; }; then
  17945. +  ac_header_compiler=yes
  17946. +else
  17947. +  echo "$as_me: failed program was:" >&5
  17948. +sed 's/^/| /' conftest.$ac_ext >&5
  17949. +
  17950. +ac_header_compiler=no
  17951. +fi
  17952. +rm -f conftest.$ac_objext conftest.$ac_ext
  17953. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  17954. +echo "${ECHO_T}$ac_header_compiler" >&6
  17955. +
  17956. +# Is the header present?
  17957. +echo "$as_me:$LINENO: checking $ac_header presence" >&5
  17958. +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
  17959. +cat >conftest.$ac_ext <<_ACEOF
  17960. +#line $LINENO "configure"
  17961. +/* confdefs.h.  */
  17962. +_ACEOF
  17963. +cat confdefs.h >>conftest.$ac_ext
  17964. +cat >>conftest.$ac_ext <<_ACEOF
  17965. +/* end confdefs.h.  */
  17966. +#include <$ac_header>
  17967. +_ACEOF
  17968. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  17969. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  17970. +  ac_status=$?
  17971. +  grep -v '^ *+' conftest.er1 >conftest.err
  17972. +  rm -f conftest.er1
  17973. +  cat conftest.err >&5
  17974. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17975. +  (exit $ac_status); } >/dev/null; then
  17976. +  if test -s conftest.err; then
  17977. +    ac_cpp_err=$ac_c_preproc_warn_flag
  17978. +  else
  17979. +    ac_cpp_err=
  17980. +  fi
  17981. +else
  17982. +  ac_cpp_err=yes
  17983. +fi
  17984. +if test -z "$ac_cpp_err"; then
  17985. +  ac_header_preproc=yes
  17986. +else
  17987. +  echo "$as_me: failed program was:" >&5
  17988. +sed 's/^/| /' conftest.$ac_ext >&5
  17989. +
  17990. +  ac_header_preproc=no
  17991. +fi
  17992. +rm -f conftest.err conftest.$ac_ext
  17993. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  17994. +echo "${ECHO_T}$ac_header_preproc" >&6
  17995. +
  17996. +# So?  What about this header?
  17997. +case $ac_header_compiler:$ac_header_preproc in
  17998. +  yes:no )
  17999. +    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
  18000. +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
  18001. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  18002. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  18003. +    (
  18004. +      cat <<\_ASBOX
  18005. +## ------------------------------------ ##
  18006. +## Report this to bug-autoconf@gnu.org. ##
  18007. +## ------------------------------------ ##
  18008. +_ASBOX
  18009. +    ) |
  18010. +      sed "s/^/$as_me: WARNING:     /" >&2
  18011. +    ;;
  18012. +  no:yes )
  18013. +    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
  18014. +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
  18015. +    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
  18016. +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
  18017. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  18018. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  18019. +    (
  18020. +      cat <<\_ASBOX
  18021. +## ------------------------------------ ##
  18022. +## Report this to bug-autoconf@gnu.org. ##
  18023. +## ------------------------------------ ##
  18024. +_ASBOX
  18025. +    ) |
  18026. +      sed "s/^/$as_me: WARNING:     /" >&2
  18027. +    ;;
  18028. +esac
  18029. +echo "$as_me:$LINENO: checking for $ac_header" >&5
  18030. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  18031. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  18032. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18033.  else
  18034. -  echo "$ac_err" >&5
  18035. -  echo "configure: failed program was:" >&5
  18036. -  cat conftest.$ac_ext >&5
  18037. -  rm -rf conftest*
  18038. -  eval "ac_cv_header_$ac_safe=no"
  18039. +  eval "$as_ac_Header=$ac_header_preproc"
  18040.  fi
  18041. -rm -f conftest*
  18042. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  18043. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  18044. +
  18045.  fi
  18046. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  18047. -  echo "$ac_t""yes" 1>&6
  18048. -    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  18049. -  cat >> confdefs.h <<EOF
  18050. -#define $ac_tr_hdr 1
  18051. -EOF
  18052. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  18053. +  cat >>confdefs.h <<_ACEOF
  18054. +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  18055. +_ACEOF
  18056.   
  18057. -else
  18058. -  echo "$ac_t""no" 1>&6
  18059.  fi
  18060. +
  18061.  done
  18062.  
  18063.    if test "$ac_cv_header_sys_procfs_h" = yes; then
  18064. @@ -5371,590 +9280,911 @@
  18065.  done
  18066.  
  18067.    if test "$ac_cv_header_sys_procfs_h" = yes; then
  18068. -    echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6
  18069. -echo "configure:5376: checking for prstatus_t in sys/procfs.h" >&5
  18070. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then
  18071. -  echo $ac_n "(cached) $ac_c" 1>&6
  18072. -else
  18073. -  cat > conftest.$ac_ext <<EOF
  18074. -#line 5381 "configure"
  18075. -#include "confdefs.h"
  18076. +    echo "$as_me:$LINENO: checking for prstatus_t in sys/procfs.h" >&5
  18077. +echo $ECHO_N "checking for prstatus_t in sys/procfs.h... $ECHO_C" >&6
  18078. + if test "${bfd_cv_have_sys_procfs_type_prstatus_t+set}" = set; then
  18079. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18080. +else
  18081. +  cat >conftest.$ac_ext <<_ACEOF
  18082. +#line $LINENO "configure"
  18083. +/* confdefs.h.  */
  18084. +_ACEOF
  18085. +cat confdefs.h >>conftest.$ac_ext
  18086. +cat >>conftest.$ac_ext <<_ACEOF
  18087. +/* end confdefs.h.  */
  18088.  
  18089.  #define _SYSCALL32
  18090.  #include <sys/procfs.h>
  18091. -int main() {
  18092. +int
  18093. +main ()
  18094. +{
  18095.  prstatus_t avar
  18096. -; return 0; }
  18097. -EOF
  18098. -if { (eval echo configure:5390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18099. -  rm -rf conftest*
  18100. +  ;
  18101. +  return 0;
  18102. +}
  18103. +_ACEOF
  18104. +rm -f conftest.$ac_objext
  18105. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18106. +  (eval $ac_compile) 2>&5
  18107. +  ac_status=$?
  18108. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18109. +  (exit $ac_status); } &&
  18110. +         { ac_try='test -s conftest.$ac_objext'
  18111. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18112. +  (eval $ac_try) 2>&5
  18113. +  ac_status=$?
  18114. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18115. +  (exit $ac_status); }; }; then
  18116.    bfd_cv_have_sys_procfs_type_prstatus_t=yes
  18117.  else
  18118. -  echo "configure: failed program was:" >&5
  18119. -  cat conftest.$ac_ext >&5
  18120. -  rm -rf conftest*
  18121. -  bfd_cv_have_sys_procfs_type_prstatus_t=no
  18122. +  echo "$as_me: failed program was:" >&5
  18123. +sed 's/^/| /' conftest.$ac_ext >&5
  18124. +
  18125. +bfd_cv_have_sys_procfs_type_prstatus_t=no
  18126.     
  18127.  fi
  18128. -rm -f conftest*
  18129. +rm -f conftest.$ac_objext conftest.$ac_ext
  18130.  fi
  18131.  
  18132.   if test $bfd_cv_have_sys_procfs_type_prstatus_t = yes; then
  18133. -   cat >> confdefs.h <<\EOF
  18134. +
  18135. +cat >>confdefs.h <<\_ACEOF
  18136.  #define HAVE_PRSTATUS_T 1
  18137. -EOF
  18138. +_ACEOF
  18139.  
  18140.   fi
  18141. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6
  18142. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prstatus_t" >&5
  18143. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prstatus_t" >&6
  18144.  
  18145. -    echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6
  18146. -echo "configure:5412: checking for prstatus32_t in sys/procfs.h" >&5
  18147. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then
  18148. -  echo $ac_n "(cached) $ac_c" 1>&6
  18149. -else
  18150. -  cat > conftest.$ac_ext <<EOF
  18151. -#line 5417 "configure"
  18152. -#include "confdefs.h"
  18153. +    echo "$as_me:$LINENO: checking for prstatus32_t in sys/procfs.h" >&5
  18154. +echo $ECHO_N "checking for prstatus32_t in sys/procfs.h... $ECHO_C" >&6
  18155. + if test "${bfd_cv_have_sys_procfs_type_prstatus32_t+set}" = set; then
  18156. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18157. +else
  18158. +  cat >conftest.$ac_ext <<_ACEOF
  18159. +#line $LINENO "configure"
  18160. +/* confdefs.h.  */
  18161. +_ACEOF
  18162. +cat confdefs.h >>conftest.$ac_ext
  18163. +cat >>conftest.$ac_ext <<_ACEOF
  18164. +/* end confdefs.h.  */
  18165.  
  18166.  #define _SYSCALL32
  18167.  #include <sys/procfs.h>
  18168. -int main() {
  18169. +int
  18170. +main ()
  18171. +{
  18172.  prstatus32_t avar
  18173. -; return 0; }
  18174. -EOF
  18175. -if { (eval echo configure:5426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18176. -  rm -rf conftest*
  18177. +  ;
  18178. +  return 0;
  18179. +}
  18180. +_ACEOF
  18181. +rm -f conftest.$ac_objext
  18182. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18183. +  (eval $ac_compile) 2>&5
  18184. +  ac_status=$?
  18185. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18186. +  (exit $ac_status); } &&
  18187. +         { ac_try='test -s conftest.$ac_objext'
  18188. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18189. +  (eval $ac_try) 2>&5
  18190. +  ac_status=$?
  18191. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18192. +  (exit $ac_status); }; }; then
  18193.    bfd_cv_have_sys_procfs_type_prstatus32_t=yes
  18194.  else
  18195. -  echo "configure: failed program was:" >&5
  18196. -  cat conftest.$ac_ext >&5
  18197. -  rm -rf conftest*
  18198. -  bfd_cv_have_sys_procfs_type_prstatus32_t=no
  18199. +  echo "$as_me: failed program was:" >&5
  18200. +sed 's/^/| /' conftest.$ac_ext >&5
  18201. +
  18202. +bfd_cv_have_sys_procfs_type_prstatus32_t=no
  18203.     
  18204.  fi
  18205. -rm -f conftest*
  18206. +rm -f conftest.$ac_objext conftest.$ac_ext
  18207.  fi
  18208.  
  18209.   if test $bfd_cv_have_sys_procfs_type_prstatus32_t = yes; then
  18210. -   cat >> confdefs.h <<\EOF
  18211. +
  18212. +cat >>confdefs.h <<\_ACEOF
  18213.  #define HAVE_PRSTATUS32_T 1
  18214. -EOF
  18215. +_ACEOF
  18216.  
  18217.   fi
  18218. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6
  18219. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prstatus32_t" >&5
  18220. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prstatus32_t" >&6
  18221.  
  18222. -    echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
  18223. -echo "configure:5448: checking for prstatus_t.pr_who in sys/procfs.h" >&5
  18224. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then
  18225. -  echo $ac_n "(cached) $ac_c" 1>&6
  18226. -else
  18227. -  cat > conftest.$ac_ext <<EOF
  18228. -#line 5453 "configure"
  18229. -#include "confdefs.h"
  18230. +    echo "$as_me:$LINENO: checking for prstatus_t.pr_who in sys/procfs.h" >&5
  18231. +echo $ECHO_N "checking for prstatus_t.pr_who in sys/procfs.h... $ECHO_C" >&6
  18232. + if test "${bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who+set}" = set; then
  18233. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18234. +else
  18235. +  cat >conftest.$ac_ext <<_ACEOF
  18236. +#line $LINENO "configure"
  18237. +/* confdefs.h.  */
  18238. +_ACEOF
  18239. +cat confdefs.h >>conftest.$ac_ext
  18240. +cat >>conftest.$ac_ext <<_ACEOF
  18241. +/* end confdefs.h.  */
  18242.  
  18243.  #define _SYSCALL32
  18244.  #include <sys/procfs.h>
  18245. -int main() {
  18246. +int
  18247. +main ()
  18248. +{
  18249.  prstatus_t avar; void* aref = (void*) &avar.pr_who
  18250. -; return 0; }
  18251. -EOF
  18252. -if { (eval echo configure:5462: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18253. -  rm -rf conftest*
  18254. +  ;
  18255. +  return 0;
  18256. +}
  18257. +_ACEOF
  18258. +rm -f conftest.$ac_objext
  18259. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18260. +  (eval $ac_compile) 2>&5
  18261. +  ac_status=$?
  18262. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18263. +  (exit $ac_status); } &&
  18264. +         { ac_try='test -s conftest.$ac_objext'
  18265. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18266. +  (eval $ac_try) 2>&5
  18267. +  ac_status=$?
  18268. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18269. +  (exit $ac_status); }; }; then
  18270.    bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes
  18271.  else
  18272. -  echo "configure: failed program was:" >&5
  18273. -  cat conftest.$ac_ext >&5
  18274. -  rm -rf conftest*
  18275. -  bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=no
  18276. +  echo "$as_me: failed program was:" >&5
  18277. +sed 's/^/| /' conftest.$ac_ext >&5
  18278. +
  18279. +bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=no
  18280.     
  18281.  fi
  18282. -rm -f conftest*
  18283. +rm -f conftest.$ac_objext conftest.$ac_ext
  18284.  fi
  18285.  
  18286.   if test $bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who = yes; then
  18287. -   cat >> confdefs.h <<\EOF
  18288. +
  18289. +cat >>confdefs.h <<\_ACEOF
  18290.  #define HAVE_PRSTATUS_T_PR_WHO 1
  18291. -EOF
  18292. +_ACEOF
  18293.  
  18294.   fi
  18295. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6
  18296. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" >&5
  18297. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" >&6
  18298.  
  18299. -    echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
  18300. -echo "configure:5484: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
  18301. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then
  18302. -  echo $ac_n "(cached) $ac_c" 1>&6
  18303. -else
  18304. -  cat > conftest.$ac_ext <<EOF
  18305. -#line 5489 "configure"
  18306. -#include "confdefs.h"
  18307. +    echo "$as_me:$LINENO: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
  18308. +echo $ECHO_N "checking for prstatus32_t.pr_who in sys/procfs.h... $ECHO_C" >&6
  18309. + if test "${bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who+set}" = set; then
  18310. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18311. +else
  18312. +  cat >conftest.$ac_ext <<_ACEOF
  18313. +#line $LINENO "configure"
  18314. +/* confdefs.h.  */
  18315. +_ACEOF
  18316. +cat confdefs.h >>conftest.$ac_ext
  18317. +cat >>conftest.$ac_ext <<_ACEOF
  18318. +/* end confdefs.h.  */
  18319.  
  18320.  #define _SYSCALL32
  18321.  #include <sys/procfs.h>
  18322. -int main() {
  18323. +int
  18324. +main ()
  18325. +{
  18326.  prstatus32_t avar; void* aref = (void*) &avar.pr_who
  18327. -; return 0; }
  18328. -EOF
  18329. -if { (eval echo configure:5498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18330. -  rm -rf conftest*
  18331. +  ;
  18332. +  return 0;
  18333. +}
  18334. +_ACEOF
  18335. +rm -f conftest.$ac_objext
  18336. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18337. +  (eval $ac_compile) 2>&5
  18338. +  ac_status=$?
  18339. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18340. +  (exit $ac_status); } &&
  18341. +         { ac_try='test -s conftest.$ac_objext'
  18342. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18343. +  (eval $ac_try) 2>&5
  18344. +  ac_status=$?
  18345. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18346. +  (exit $ac_status); }; }; then
  18347.    bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes
  18348.  else
  18349. -  echo "configure: failed program was:" >&5
  18350. -  cat conftest.$ac_ext >&5
  18351. -  rm -rf conftest*
  18352. -  bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=no
  18353. +  echo "$as_me: failed program was:" >&5
  18354. +sed 's/^/| /' conftest.$ac_ext >&5
  18355. +
  18356. +bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=no
  18357.     
  18358.  fi
  18359. -rm -f conftest*
  18360. +rm -f conftest.$ac_objext conftest.$ac_ext
  18361.  fi
  18362.  
  18363.   if test $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who = yes; then
  18364. -   cat >> confdefs.h <<\EOF
  18365. +
  18366. +cat >>confdefs.h <<\_ACEOF
  18367.  #define HAVE_PRSTATUS32_T_PR_WHO 1
  18368. -EOF
  18369. +_ACEOF
  18370.  
  18371.   fi
  18372. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6
  18373. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" >&5
  18374. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" >&6
  18375.  
  18376. -    echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
  18377. -echo "configure:5520: checking for pstatus_t in sys/procfs.h" >&5
  18378. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then
  18379. -  echo $ac_n "(cached) $ac_c" 1>&6
  18380. -else
  18381. -  cat > conftest.$ac_ext <<EOF
  18382. -#line 5525 "configure"
  18383. -#include "confdefs.h"
  18384. +    echo "$as_me:$LINENO: checking for pstatus_t in sys/procfs.h" >&5
  18385. +echo $ECHO_N "checking for pstatus_t in sys/procfs.h... $ECHO_C" >&6
  18386. + if test "${bfd_cv_have_sys_procfs_type_pstatus_t+set}" = set; then
  18387. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18388. +else
  18389. +  cat >conftest.$ac_ext <<_ACEOF
  18390. +#line $LINENO "configure"
  18391. +/* confdefs.h.  */
  18392. +_ACEOF
  18393. +cat confdefs.h >>conftest.$ac_ext
  18394. +cat >>conftest.$ac_ext <<_ACEOF
  18395. +/* end confdefs.h.  */
  18396.  
  18397.  #define _SYSCALL32
  18398.  #include <sys/procfs.h>
  18399. -int main() {
  18400. +int
  18401. +main ()
  18402. +{
  18403.  pstatus_t avar
  18404. -; return 0; }
  18405. -EOF
  18406. -if { (eval echo configure:5534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18407. -  rm -rf conftest*
  18408. +  ;
  18409. +  return 0;
  18410. +}
  18411. +_ACEOF
  18412. +rm -f conftest.$ac_objext
  18413. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18414. +  (eval $ac_compile) 2>&5
  18415. +  ac_status=$?
  18416. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18417. +  (exit $ac_status); } &&
  18418. +         { ac_try='test -s conftest.$ac_objext'
  18419. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18420. +  (eval $ac_try) 2>&5
  18421. +  ac_status=$?
  18422. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18423. +  (exit $ac_status); }; }; then
  18424.    bfd_cv_have_sys_procfs_type_pstatus_t=yes
  18425.  else
  18426. -  echo "configure: failed program was:" >&5
  18427. -  cat conftest.$ac_ext >&5
  18428. -  rm -rf conftest*
  18429. -  bfd_cv_have_sys_procfs_type_pstatus_t=no
  18430. +  echo "$as_me: failed program was:" >&5
  18431. +sed 's/^/| /' conftest.$ac_ext >&5
  18432. +
  18433. +bfd_cv_have_sys_procfs_type_pstatus_t=no
  18434.     
  18435.  fi
  18436. -rm -f conftest*
  18437. +rm -f conftest.$ac_objext conftest.$ac_ext
  18438.  fi
  18439.  
  18440.   if test $bfd_cv_have_sys_procfs_type_pstatus_t = yes; then
  18441. -   cat >> confdefs.h <<\EOF
  18442. +
  18443. +cat >>confdefs.h <<\_ACEOF
  18444.  #define HAVE_PSTATUS_T 1
  18445. -EOF
  18446. +_ACEOF
  18447.  
  18448.   fi
  18449. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
  18450. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pstatus_t" >&5
  18451. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pstatus_t" >&6
  18452.  
  18453. -    echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6
  18454. -echo "configure:5556: checking for pxstatus_t in sys/procfs.h" >&5
  18455. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then
  18456. -  echo $ac_n "(cached) $ac_c" 1>&6
  18457. -else
  18458. -  cat > conftest.$ac_ext <<EOF
  18459. -#line 5561 "configure"
  18460. -#include "confdefs.h"
  18461. +    echo "$as_me:$LINENO: checking for pxstatus_t in sys/procfs.h" >&5
  18462. +echo $ECHO_N "checking for pxstatus_t in sys/procfs.h... $ECHO_C" >&6
  18463. + if test "${bfd_cv_have_sys_procfs_type_pxstatus_t+set}" = set; then
  18464. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18465. +else
  18466. +  cat >conftest.$ac_ext <<_ACEOF
  18467. +#line $LINENO "configure"
  18468. +/* confdefs.h.  */
  18469. +_ACEOF
  18470. +cat confdefs.h >>conftest.$ac_ext
  18471. +cat >>conftest.$ac_ext <<_ACEOF
  18472. +/* end confdefs.h.  */
  18473.  
  18474.  #define _SYSCALL32
  18475.  #include <sys/procfs.h>
  18476. -int main() {
  18477. +int
  18478. +main ()
  18479. +{
  18480.  pxstatus_t avar
  18481. -; return 0; }
  18482. -EOF
  18483. -if { (eval echo configure:5570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18484. -  rm -rf conftest*
  18485. +  ;
  18486. +  return 0;
  18487. +}
  18488. +_ACEOF
  18489. +rm -f conftest.$ac_objext
  18490. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18491. +  (eval $ac_compile) 2>&5
  18492. +  ac_status=$?
  18493. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18494. +  (exit $ac_status); } &&
  18495. +         { ac_try='test -s conftest.$ac_objext'
  18496. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18497. +  (eval $ac_try) 2>&5
  18498. +  ac_status=$?
  18499. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18500. +  (exit $ac_status); }; }; then
  18501.    bfd_cv_have_sys_procfs_type_pxstatus_t=yes
  18502.  else
  18503. -  echo "configure: failed program was:" >&5
  18504. -  cat conftest.$ac_ext >&5
  18505. -  rm -rf conftest*
  18506. -  bfd_cv_have_sys_procfs_type_pxstatus_t=no
  18507. +  echo "$as_me: failed program was:" >&5
  18508. +sed 's/^/| /' conftest.$ac_ext >&5
  18509. +
  18510. +bfd_cv_have_sys_procfs_type_pxstatus_t=no
  18511.     
  18512.  fi
  18513. -rm -f conftest*
  18514. +rm -f conftest.$ac_objext conftest.$ac_ext
  18515.  fi
  18516.  
  18517.   if test $bfd_cv_have_sys_procfs_type_pxstatus_t = yes; then
  18518. -   cat >> confdefs.h <<\EOF
  18519. +
  18520. +cat >>confdefs.h <<\_ACEOF
  18521.  #define HAVE_PXSTATUS_T 1
  18522. -EOF
  18523. +_ACEOF
  18524.  
  18525.   fi
  18526. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6
  18527. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pxstatus_t" >&5
  18528. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pxstatus_t" >&6
  18529.  
  18530. -    echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6
  18531. -echo "configure:5592: checking for pstatus32_t in sys/procfs.h" >&5
  18532. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then
  18533. -  echo $ac_n "(cached) $ac_c" 1>&6
  18534. -else
  18535. -  cat > conftest.$ac_ext <<EOF
  18536. -#line 5597 "configure"
  18537. -#include "confdefs.h"
  18538. +    echo "$as_me:$LINENO: checking for pstatus32_t in sys/procfs.h" >&5
  18539. +echo $ECHO_N "checking for pstatus32_t in sys/procfs.h... $ECHO_C" >&6
  18540. + if test "${bfd_cv_have_sys_procfs_type_pstatus32_t+set}" = set; then
  18541. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18542. +else
  18543. +  cat >conftest.$ac_ext <<_ACEOF
  18544. +#line $LINENO "configure"
  18545. +/* confdefs.h.  */
  18546. +_ACEOF
  18547. +cat confdefs.h >>conftest.$ac_ext
  18548. +cat >>conftest.$ac_ext <<_ACEOF
  18549. +/* end confdefs.h.  */
  18550.  
  18551.  #define _SYSCALL32
  18552.  #include <sys/procfs.h>
  18553. -int main() {
  18554. +int
  18555. +main ()
  18556. +{
  18557.  pstatus32_t avar
  18558. -; return 0; }
  18559. -EOF
  18560. -if { (eval echo configure:5606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18561. -  rm -rf conftest*
  18562. +  ;
  18563. +  return 0;
  18564. +}
  18565. +_ACEOF
  18566. +rm -f conftest.$ac_objext
  18567. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18568. +  (eval $ac_compile) 2>&5
  18569. +  ac_status=$?
  18570. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18571. +  (exit $ac_status); } &&
  18572. +         { ac_try='test -s conftest.$ac_objext'
  18573. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18574. +  (eval $ac_try) 2>&5
  18575. +  ac_status=$?
  18576. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18577. +  (exit $ac_status); }; }; then
  18578.    bfd_cv_have_sys_procfs_type_pstatus32_t=yes
  18579.  else
  18580. -  echo "configure: failed program was:" >&5
  18581. -  cat conftest.$ac_ext >&5
  18582. -  rm -rf conftest*
  18583. -  bfd_cv_have_sys_procfs_type_pstatus32_t=no
  18584. +  echo "$as_me: failed program was:" >&5
  18585. +sed 's/^/| /' conftest.$ac_ext >&5
  18586. +
  18587. +bfd_cv_have_sys_procfs_type_pstatus32_t=no
  18588.     
  18589.  fi
  18590. -rm -f conftest*
  18591. +rm -f conftest.$ac_objext conftest.$ac_ext
  18592.  fi
  18593.  
  18594.   if test $bfd_cv_have_sys_procfs_type_pstatus32_t = yes; then
  18595. -   cat >> confdefs.h <<\EOF
  18596. +
  18597. +cat >>confdefs.h <<\_ACEOF
  18598.  #define HAVE_PSTATUS32_T 1
  18599. -EOF
  18600. +_ACEOF
  18601.  
  18602.   fi
  18603. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6
  18604. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pstatus32_t" >&5
  18605. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pstatus32_t" >&6
  18606.  
  18607. -    echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6
  18608. -echo "configure:5628: checking for prpsinfo_t in sys/procfs.h" >&5
  18609. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then
  18610. -  echo $ac_n "(cached) $ac_c" 1>&6
  18611. -else
  18612. -  cat > conftest.$ac_ext <<EOF
  18613. -#line 5633 "configure"
  18614. -#include "confdefs.h"
  18615. +    echo "$as_me:$LINENO: checking for prpsinfo_t in sys/procfs.h" >&5
  18616. +echo $ECHO_N "checking for prpsinfo_t in sys/procfs.h... $ECHO_C" >&6
  18617. + if test "${bfd_cv_have_sys_procfs_type_prpsinfo_t+set}" = set; then
  18618. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18619. +else
  18620. +  cat >conftest.$ac_ext <<_ACEOF
  18621. +#line $LINENO "configure"
  18622. +/* confdefs.h.  */
  18623. +_ACEOF
  18624. +cat confdefs.h >>conftest.$ac_ext
  18625. +cat >>conftest.$ac_ext <<_ACEOF
  18626. +/* end confdefs.h.  */
  18627.  
  18628.  #define _SYSCALL32
  18629.  #include <sys/procfs.h>
  18630. -int main() {
  18631. +int
  18632. +main ()
  18633. +{
  18634.  prpsinfo_t avar
  18635. -; return 0; }
  18636. -EOF
  18637. -if { (eval echo configure:5642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18638. -  rm -rf conftest*
  18639. +  ;
  18640. +  return 0;
  18641. +}
  18642. +_ACEOF
  18643. +rm -f conftest.$ac_objext
  18644. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18645. +  (eval $ac_compile) 2>&5
  18646. +  ac_status=$?
  18647. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18648. +  (exit $ac_status); } &&
  18649. +         { ac_try='test -s conftest.$ac_objext'
  18650. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18651. +  (eval $ac_try) 2>&5
  18652. +  ac_status=$?
  18653. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18654. +  (exit $ac_status); }; }; then
  18655.    bfd_cv_have_sys_procfs_type_prpsinfo_t=yes
  18656.  else
  18657. -  echo "configure: failed program was:" >&5
  18658. -  cat conftest.$ac_ext >&5
  18659. -  rm -rf conftest*
  18660. -  bfd_cv_have_sys_procfs_type_prpsinfo_t=no
  18661. +  echo "$as_me: failed program was:" >&5
  18662. +sed 's/^/| /' conftest.$ac_ext >&5
  18663. +
  18664. +bfd_cv_have_sys_procfs_type_prpsinfo_t=no
  18665.     
  18666.  fi
  18667. -rm -f conftest*
  18668. +rm -f conftest.$ac_objext conftest.$ac_ext
  18669.  fi
  18670.  
  18671.   if test $bfd_cv_have_sys_procfs_type_prpsinfo_t = yes; then
  18672. -   cat >> confdefs.h <<\EOF
  18673. +
  18674. +cat >>confdefs.h <<\_ACEOF
  18675.  #define HAVE_PRPSINFO_T 1
  18676. -EOF
  18677. +_ACEOF
  18678.  
  18679.   fi
  18680. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6
  18681. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prpsinfo_t" >&5
  18682. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prpsinfo_t" >&6
  18683.  
  18684. -    echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6
  18685. -echo "configure:5664: checking for prpsinfo32_t in sys/procfs.h" >&5
  18686. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then
  18687. -  echo $ac_n "(cached) $ac_c" 1>&6
  18688. -else
  18689. -  cat > conftest.$ac_ext <<EOF
  18690. -#line 5669 "configure"
  18691. -#include "confdefs.h"
  18692. +    echo "$as_me:$LINENO: checking for prpsinfo32_t in sys/procfs.h" >&5
  18693. +echo $ECHO_N "checking for prpsinfo32_t in sys/procfs.h... $ECHO_C" >&6
  18694. + if test "${bfd_cv_have_sys_procfs_type_prpsinfo32_t+set}" = set; then
  18695. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18696. +else
  18697. +  cat >conftest.$ac_ext <<_ACEOF
  18698. +#line $LINENO "configure"
  18699. +/* confdefs.h.  */
  18700. +_ACEOF
  18701. +cat confdefs.h >>conftest.$ac_ext
  18702. +cat >>conftest.$ac_ext <<_ACEOF
  18703. +/* end confdefs.h.  */
  18704.  
  18705.  #define _SYSCALL32
  18706.  #include <sys/procfs.h>
  18707. -int main() {
  18708. +int
  18709. +main ()
  18710. +{
  18711.  prpsinfo32_t avar
  18712. -; return 0; }
  18713. -EOF
  18714. -if { (eval echo configure:5678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18715. -  rm -rf conftest*
  18716. +  ;
  18717. +  return 0;
  18718. +}
  18719. +_ACEOF
  18720. +rm -f conftest.$ac_objext
  18721. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18722. +  (eval $ac_compile) 2>&5
  18723. +  ac_status=$?
  18724. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18725. +  (exit $ac_status); } &&
  18726. +         { ac_try='test -s conftest.$ac_objext'
  18727. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18728. +  (eval $ac_try) 2>&5
  18729. +  ac_status=$?
  18730. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18731. +  (exit $ac_status); }; }; then
  18732.    bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes
  18733.  else
  18734. -  echo "configure: failed program was:" >&5
  18735. -  cat conftest.$ac_ext >&5
  18736. -  rm -rf conftest*
  18737. -  bfd_cv_have_sys_procfs_type_prpsinfo32_t=no
  18738. +  echo "$as_me: failed program was:" >&5
  18739. +sed 's/^/| /' conftest.$ac_ext >&5
  18740. +
  18741. +bfd_cv_have_sys_procfs_type_prpsinfo32_t=no
  18742.     
  18743.  fi
  18744. -rm -f conftest*
  18745. +rm -f conftest.$ac_objext conftest.$ac_ext
  18746.  fi
  18747.  
  18748.   if test $bfd_cv_have_sys_procfs_type_prpsinfo32_t = yes; then
  18749. -   cat >> confdefs.h <<\EOF
  18750. +
  18751. +cat >>confdefs.h <<\_ACEOF
  18752.  #define HAVE_PRPSINFO32_T 1
  18753. -EOF
  18754. +_ACEOF
  18755.  
  18756.   fi
  18757. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6
  18758. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&5
  18759. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&6
  18760.  
  18761. -    echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6
  18762. -echo "configure:5700: checking for psinfo_t in sys/procfs.h" >&5
  18763. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then
  18764. -  echo $ac_n "(cached) $ac_c" 1>&6
  18765. -else
  18766. -  cat > conftest.$ac_ext <<EOF
  18767. -#line 5705 "configure"
  18768. -#include "confdefs.h"
  18769. +    echo "$as_me:$LINENO: checking for psinfo_t in sys/procfs.h" >&5
  18770. +echo $ECHO_N "checking for psinfo_t in sys/procfs.h... $ECHO_C" >&6
  18771. + if test "${bfd_cv_have_sys_procfs_type_psinfo_t+set}" = set; then
  18772. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18773. +else
  18774. +  cat >conftest.$ac_ext <<_ACEOF
  18775. +#line $LINENO "configure"
  18776. +/* confdefs.h.  */
  18777. +_ACEOF
  18778. +cat confdefs.h >>conftest.$ac_ext
  18779. +cat >>conftest.$ac_ext <<_ACEOF
  18780. +/* end confdefs.h.  */
  18781.  
  18782.  #define _SYSCALL32
  18783.  #include <sys/procfs.h>
  18784. -int main() {
  18785. +int
  18786. +main ()
  18787. +{
  18788.  psinfo_t avar
  18789. -; return 0; }
  18790. -EOF
  18791. -if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18792. -  rm -rf conftest*
  18793. +  ;
  18794. +  return 0;
  18795. +}
  18796. +_ACEOF
  18797. +rm -f conftest.$ac_objext
  18798. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18799. +  (eval $ac_compile) 2>&5
  18800. +  ac_status=$?
  18801. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18802. +  (exit $ac_status); } &&
  18803. +         { ac_try='test -s conftest.$ac_objext'
  18804. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18805. +  (eval $ac_try) 2>&5
  18806. +  ac_status=$?
  18807. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18808. +  (exit $ac_status); }; }; then
  18809.    bfd_cv_have_sys_procfs_type_psinfo_t=yes
  18810.  else
  18811. -  echo "configure: failed program was:" >&5
  18812. -  cat conftest.$ac_ext >&5
  18813. -  rm -rf conftest*
  18814. -  bfd_cv_have_sys_procfs_type_psinfo_t=no
  18815. +  echo "$as_me: failed program was:" >&5
  18816. +sed 's/^/| /' conftest.$ac_ext >&5
  18817. +
  18818. +bfd_cv_have_sys_procfs_type_psinfo_t=no
  18819.     
  18820.  fi
  18821. -rm -f conftest*
  18822. +rm -f conftest.$ac_objext conftest.$ac_ext
  18823.  fi
  18824.  
  18825.   if test $bfd_cv_have_sys_procfs_type_psinfo_t = yes; then
  18826. -   cat >> confdefs.h <<\EOF
  18827. +
  18828. +cat >>confdefs.h <<\_ACEOF
  18829.  #define HAVE_PSINFO_T 1
  18830. -EOF
  18831. +_ACEOF
  18832.  
  18833.   fi
  18834. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6
  18835. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_psinfo_t" >&5
  18836. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_psinfo_t" >&6
  18837.  
  18838. -    echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6
  18839. -echo "configure:5736: checking for psinfo32_t in sys/procfs.h" >&5
  18840. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then
  18841. -  echo $ac_n "(cached) $ac_c" 1>&6
  18842. -else
  18843. -  cat > conftest.$ac_ext <<EOF
  18844. -#line 5741 "configure"
  18845. -#include "confdefs.h"
  18846. +    echo "$as_me:$LINENO: checking for psinfo32_t in sys/procfs.h" >&5
  18847. +echo $ECHO_N "checking for psinfo32_t in sys/procfs.h... $ECHO_C" >&6
  18848. + if test "${bfd_cv_have_sys_procfs_type_psinfo32_t+set}" = set; then
  18849. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18850. +else
  18851. +  cat >conftest.$ac_ext <<_ACEOF
  18852. +#line $LINENO "configure"
  18853. +/* confdefs.h.  */
  18854. +_ACEOF
  18855. +cat confdefs.h >>conftest.$ac_ext
  18856. +cat >>conftest.$ac_ext <<_ACEOF
  18857. +/* end confdefs.h.  */
  18858.  
  18859.  #define _SYSCALL32
  18860.  #include <sys/procfs.h>
  18861. -int main() {
  18862. +int
  18863. +main ()
  18864. +{
  18865.  psinfo32_t avar
  18866. -; return 0; }
  18867. -EOF
  18868. -if { (eval echo configure:5750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18869. -  rm -rf conftest*
  18870. +  ;
  18871. +  return 0;
  18872. +}
  18873. +_ACEOF
  18874. +rm -f conftest.$ac_objext
  18875. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18876. +  (eval $ac_compile) 2>&5
  18877. +  ac_status=$?
  18878. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18879. +  (exit $ac_status); } &&
  18880. +         { ac_try='test -s conftest.$ac_objext'
  18881. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18882. +  (eval $ac_try) 2>&5
  18883. +  ac_status=$?
  18884. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18885. +  (exit $ac_status); }; }; then
  18886.    bfd_cv_have_sys_procfs_type_psinfo32_t=yes
  18887.  else
  18888. -  echo "configure: failed program was:" >&5
  18889. -  cat conftest.$ac_ext >&5
  18890. -  rm -rf conftest*
  18891. -  bfd_cv_have_sys_procfs_type_psinfo32_t=no
  18892. +  echo "$as_me: failed program was:" >&5
  18893. +sed 's/^/| /' conftest.$ac_ext >&5
  18894. +
  18895. +bfd_cv_have_sys_procfs_type_psinfo32_t=no
  18896.     
  18897.  fi
  18898. -rm -f conftest*
  18899. +rm -f conftest.$ac_objext conftest.$ac_ext
  18900.  fi
  18901.  
  18902.   if test $bfd_cv_have_sys_procfs_type_psinfo32_t = yes; then
  18903. -   cat >> confdefs.h <<\EOF
  18904. +
  18905. +cat >>confdefs.h <<\_ACEOF
  18906.  #define HAVE_PSINFO32_T 1
  18907. -EOF
  18908. +_ACEOF
  18909.  
  18910.   fi
  18911. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6
  18912. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_psinfo32_t" >&5
  18913. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_psinfo32_t" >&6
  18914.  
  18915. -    echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6
  18916. -echo "configure:5772: checking for lwpstatus_t in sys/procfs.h" >&5
  18917. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then
  18918. -  echo $ac_n "(cached) $ac_c" 1>&6
  18919. -else
  18920. -  cat > conftest.$ac_ext <<EOF
  18921. -#line 5777 "configure"
  18922. -#include "confdefs.h"
  18923. +    echo "$as_me:$LINENO: checking for lwpstatus_t in sys/procfs.h" >&5
  18924. +echo $ECHO_N "checking for lwpstatus_t in sys/procfs.h... $ECHO_C" >&6
  18925. + if test "${bfd_cv_have_sys_procfs_type_lwpstatus_t+set}" = set; then
  18926. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  18927. +else
  18928. +  cat >conftest.$ac_ext <<_ACEOF
  18929. +#line $LINENO "configure"
  18930. +/* confdefs.h.  */
  18931. +_ACEOF
  18932. +cat confdefs.h >>conftest.$ac_ext
  18933. +cat >>conftest.$ac_ext <<_ACEOF
  18934. +/* end confdefs.h.  */
  18935.  
  18936.  #define _SYSCALL32
  18937.  #include <sys/procfs.h>
  18938. -int main() {
  18939. +int
  18940. +main ()
  18941. +{
  18942.  lwpstatus_t avar
  18943. -; return 0; }
  18944. -EOF
  18945. -if { (eval echo configure:5786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  18946. -  rm -rf conftest*
  18947. +  ;
  18948. +  return 0;
  18949. +}
  18950. +_ACEOF
  18951. +rm -f conftest.$ac_objext
  18952. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  18953. +  (eval $ac_compile) 2>&5
  18954. +  ac_status=$?
  18955. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18956. +  (exit $ac_status); } &&
  18957. +         { ac_try='test -s conftest.$ac_objext'
  18958. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  18959. +  (eval $ac_try) 2>&5
  18960. +  ac_status=$?
  18961. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  18962. +  (exit $ac_status); }; }; then
  18963.    bfd_cv_have_sys_procfs_type_lwpstatus_t=yes
  18964.  else
  18965. -  echo "configure: failed program was:" >&5
  18966. -  cat conftest.$ac_ext >&5
  18967. -  rm -rf conftest*
  18968. -  bfd_cv_have_sys_procfs_type_lwpstatus_t=no
  18969. +  echo "$as_me: failed program was:" >&5
  18970. +sed 's/^/| /' conftest.$ac_ext >&5
  18971. +
  18972. +bfd_cv_have_sys_procfs_type_lwpstatus_t=no
  18973.     
  18974.  fi
  18975. -rm -f conftest*
  18976. +rm -f conftest.$ac_objext conftest.$ac_ext
  18977.  fi
  18978.  
  18979.   if test $bfd_cv_have_sys_procfs_type_lwpstatus_t = yes; then
  18980. -   cat >> confdefs.h <<\EOF
  18981. +
  18982. +cat >>confdefs.h <<\_ACEOF
  18983.  #define HAVE_LWPSTATUS_T 1
  18984. -EOF
  18985. +_ACEOF
  18986.  
  18987.   fi
  18988. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6
  18989. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_lwpstatus_t" >&5
  18990. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_lwpstatus_t" >&6
  18991.  
  18992. -    echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6
  18993. -echo "configure:5808: checking for lwpxstatus_t in sys/procfs.h" >&5
  18994. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then
  18995. -  echo $ac_n "(cached) $ac_c" 1>&6
  18996. -else
  18997. -  cat > conftest.$ac_ext <<EOF
  18998. -#line 5813 "configure"
  18999. -#include "confdefs.h"
  19000. +    echo "$as_me:$LINENO: checking for lwpxstatus_t in sys/procfs.h" >&5
  19001. +echo $ECHO_N "checking for lwpxstatus_t in sys/procfs.h... $ECHO_C" >&6
  19002. + if test "${bfd_cv_have_sys_procfs_type_lwpxstatus_t+set}" = set; then
  19003. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19004. +else
  19005. +  cat >conftest.$ac_ext <<_ACEOF
  19006. +#line $LINENO "configure"
  19007. +/* confdefs.h.  */
  19008. +_ACEOF
  19009. +cat confdefs.h >>conftest.$ac_ext
  19010. +cat >>conftest.$ac_ext <<_ACEOF
  19011. +/* end confdefs.h.  */
  19012.  
  19013.  #define _SYSCALL32
  19014.  #include <sys/procfs.h>
  19015. -int main() {
  19016. +int
  19017. +main ()
  19018. +{
  19019.  lwpxstatus_t avar
  19020. -; return 0; }
  19021. -EOF
  19022. -if { (eval echo configure:5822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  19023. -  rm -rf conftest*
  19024. +  ;
  19025. +  return 0;
  19026. +}
  19027. +_ACEOF
  19028. +rm -f conftest.$ac_objext
  19029. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  19030. +  (eval $ac_compile) 2>&5
  19031. +  ac_status=$?
  19032. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19033. +  (exit $ac_status); } &&
  19034. +         { ac_try='test -s conftest.$ac_objext'
  19035. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  19036. +  (eval $ac_try) 2>&5
  19037. +  ac_status=$?
  19038. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19039. +  (exit $ac_status); }; }; then
  19040.    bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes
  19041.  else
  19042. -  echo "configure: failed program was:" >&5
  19043. -  cat conftest.$ac_ext >&5
  19044. -  rm -rf conftest*
  19045. -  bfd_cv_have_sys_procfs_type_lwpxstatus_t=no
  19046. +  echo "$as_me: failed program was:" >&5
  19047. +sed 's/^/| /' conftest.$ac_ext >&5
  19048. +
  19049. +bfd_cv_have_sys_procfs_type_lwpxstatus_t=no
  19050.     
  19051.  fi
  19052. -rm -f conftest*
  19053. +rm -f conftest.$ac_objext conftest.$ac_ext
  19054.  fi
  19055.  
  19056.   if test $bfd_cv_have_sys_procfs_type_lwpxstatus_t = yes; then
  19057. -   cat >> confdefs.h <<\EOF
  19058. +
  19059. +cat >>confdefs.h <<\_ACEOF
  19060.  #define HAVE_LWPXSTATUS_T 1
  19061. -EOF
  19062. +_ACEOF
  19063.  
  19064.   fi
  19065. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6
  19066. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_lwpxstatus_t" >&5
  19067. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_lwpxstatus_t" >&6
  19068.  
  19069. -    echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6
  19070. -echo "configure:5844: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
  19071. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then
  19072. -  echo $ac_n "(cached) $ac_c" 1>&6
  19073. -else
  19074. -  cat > conftest.$ac_ext <<EOF
  19075. -#line 5849 "configure"
  19076. -#include "confdefs.h"
  19077. +    echo "$as_me:$LINENO: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
  19078. +echo $ECHO_N "checking for lwpstatus_t.pr_context in sys/procfs.h... $ECHO_C" >&6
  19079. + if test "${bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context+set}" = set; then
  19080. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19081. +else
  19082. +  cat >conftest.$ac_ext <<_ACEOF
  19083. +#line $LINENO "configure"
  19084. +/* confdefs.h.  */
  19085. +_ACEOF
  19086. +cat confdefs.h >>conftest.$ac_ext
  19087. +cat >>conftest.$ac_ext <<_ACEOF
  19088. +/* end confdefs.h.  */
  19089.  
  19090.  #define _SYSCALL32
  19091.  #include <sys/procfs.h>
  19092. -int main() {
  19093. +int
  19094. +main ()
  19095. +{
  19096.  lwpstatus_t avar; void* aref = (void*) &avar.pr_context
  19097. -; return 0; }
  19098. -EOF
  19099. -if { (eval echo configure:5858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  19100. -  rm -rf conftest*
  19101. +  ;
  19102. +  return 0;
  19103. +}
  19104. +_ACEOF
  19105. +rm -f conftest.$ac_objext
  19106. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  19107. +  (eval $ac_compile) 2>&5
  19108. +  ac_status=$?
  19109. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19110. +  (exit $ac_status); } &&
  19111. +         { ac_try='test -s conftest.$ac_objext'
  19112. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  19113. +  (eval $ac_try) 2>&5
  19114. +  ac_status=$?
  19115. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19116. +  (exit $ac_status); }; }; then
  19117.    bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes
  19118.  else
  19119. -  echo "configure: failed program was:" >&5
  19120. -  cat conftest.$ac_ext >&5
  19121. -  rm -rf conftest*
  19122. -  bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=no
  19123. +  echo "$as_me: failed program was:" >&5
  19124. +sed 's/^/| /' conftest.$ac_ext >&5
  19125. +
  19126. +bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=no
  19127.     
  19128.  fi
  19129. -rm -f conftest*
  19130. +rm -f conftest.$ac_objext conftest.$ac_ext
  19131.  fi
  19132.  
  19133.   if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context = yes; then
  19134. -   cat >> confdefs.h <<\EOF
  19135. +
  19136. +cat >>confdefs.h <<\_ACEOF
  19137.  #define HAVE_LWPSTATUS_T_PR_CONTEXT 1
  19138. -EOF
  19139. +_ACEOF
  19140.  
  19141.   fi
  19142. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6
  19143. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" >&5
  19144. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" >&6
  19145.  
  19146. -    echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6
  19147. -echo "configure:5880: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
  19148. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then
  19149. -  echo $ac_n "(cached) $ac_c" 1>&6
  19150. -else
  19151. -  cat > conftest.$ac_ext <<EOF
  19152. -#line 5885 "configure"
  19153. -#include "confdefs.h"
  19154. +    echo "$as_me:$LINENO: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
  19155. +echo $ECHO_N "checking for lwpstatus_t.pr_reg in sys/procfs.h... $ECHO_C" >&6
  19156. + if test "${bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg+set}" = set; then
  19157. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19158. +else
  19159. +  cat >conftest.$ac_ext <<_ACEOF
  19160. +#line $LINENO "configure"
  19161. +/* confdefs.h.  */
  19162. +_ACEOF
  19163. +cat confdefs.h >>conftest.$ac_ext
  19164. +cat >>conftest.$ac_ext <<_ACEOF
  19165. +/* end confdefs.h.  */
  19166.  
  19167.  #define _SYSCALL32
  19168.  #include <sys/procfs.h>
  19169. -int main() {
  19170. +int
  19171. +main ()
  19172. +{
  19173.  lwpstatus_t avar; void* aref = (void*) &avar.pr_reg
  19174. -; return 0; }
  19175. -EOF
  19176. -if { (eval echo configure:5894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  19177. -  rm -rf conftest*
  19178. +  ;
  19179. +  return 0;
  19180. +}
  19181. +_ACEOF
  19182. +rm -f conftest.$ac_objext
  19183. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  19184. +  (eval $ac_compile) 2>&5
  19185. +  ac_status=$?
  19186. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19187. +  (exit $ac_status); } &&
  19188. +         { ac_try='test -s conftest.$ac_objext'
  19189. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  19190. +  (eval $ac_try) 2>&5
  19191. +  ac_status=$?
  19192. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19193. +  (exit $ac_status); }; }; then
  19194.    bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes
  19195.  else
  19196. -  echo "configure: failed program was:" >&5
  19197. -  cat conftest.$ac_ext >&5
  19198. -  rm -rf conftest*
  19199. -  bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=no
  19200. +  echo "$as_me: failed program was:" >&5
  19201. +sed 's/^/| /' conftest.$ac_ext >&5
  19202. +
  19203. +bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=no
  19204.     
  19205.  fi
  19206. -rm -f conftest*
  19207. +rm -f conftest.$ac_objext conftest.$ac_ext
  19208.  fi
  19209.  
  19210.   if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg = yes; then
  19211. -   cat >> confdefs.h <<\EOF
  19212. +
  19213. +cat >>confdefs.h <<\_ACEOF
  19214.  #define HAVE_LWPSTATUS_T_PR_REG 1
  19215. -EOF
  19216. +_ACEOF
  19217.  
  19218.   fi
  19219. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6
  19220. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" >&5
  19221. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" >&6
  19222.  
  19223. -    echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6
  19224. -echo "configure:5916: checking for win32_pstatus_t in sys/procfs.h" >&5
  19225. - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then
  19226. -  echo $ac_n "(cached) $ac_c" 1>&6
  19227. -else
  19228. -  cat > conftest.$ac_ext <<EOF
  19229. -#line 5921 "configure"
  19230. -#include "confdefs.h"
  19231. +    echo "$as_me:$LINENO: checking for win32_pstatus_t in sys/procfs.h" >&5
  19232. +echo $ECHO_N "checking for win32_pstatus_t in sys/procfs.h... $ECHO_C" >&6
  19233. + if test "${bfd_cv_have_sys_procfs_type_win32_pstatus_t+set}" = set; then
  19234. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19235. +else
  19236. +  cat >conftest.$ac_ext <<_ACEOF
  19237. +#line $LINENO "configure"
  19238. +/* confdefs.h.  */
  19239. +_ACEOF
  19240. +cat confdefs.h >>conftest.$ac_ext
  19241. +cat >>conftest.$ac_ext <<_ACEOF
  19242. +/* end confdefs.h.  */
  19243.  
  19244.  #define _SYSCALL32
  19245.  #include <sys/procfs.h>
  19246. -int main() {
  19247. +int
  19248. +main ()
  19249. +{
  19250.  win32_pstatus_t avar
  19251. -; return 0; }
  19252. -EOF
  19253. -if { (eval echo configure:5930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  19254. -  rm -rf conftest*
  19255. +  ;
  19256. +  return 0;
  19257. +}
  19258. +_ACEOF
  19259. +rm -f conftest.$ac_objext
  19260. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  19261. +  (eval $ac_compile) 2>&5
  19262. +  ac_status=$?
  19263. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19264. +  (exit $ac_status); } &&
  19265. +         { ac_try='test -s conftest.$ac_objext'
  19266. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  19267. +  (eval $ac_try) 2>&5
  19268. +  ac_status=$?
  19269. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19270. +  (exit $ac_status); }; }; then
  19271.    bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes
  19272.  else
  19273. -  echo "configure: failed program was:" >&5
  19274. -  cat conftest.$ac_ext >&5
  19275. -  rm -rf conftest*
  19276. -  bfd_cv_have_sys_procfs_type_win32_pstatus_t=no
  19277. +  echo "$as_me: failed program was:" >&5
  19278. +sed 's/^/| /' conftest.$ac_ext >&5
  19279. +
  19280. +bfd_cv_have_sys_procfs_type_win32_pstatus_t=no
  19281.     
  19282.  fi
  19283. -rm -f conftest*
  19284. +rm -f conftest.$ac_objext conftest.$ac_ext
  19285.  fi
  19286.  
  19287.   if test $bfd_cv_have_sys_procfs_type_win32_pstatus_t = yes; then
  19288. -   cat >> confdefs.h <<\EOF
  19289. +
  19290. +cat >>confdefs.h <<\_ACEOF
  19291.  #define HAVE_WIN32_PSTATUS_T 1
  19292. -EOF
  19293. +_ACEOF
  19294.  
  19295.   fi
  19296. - echo "$ac_t""$bfd_cv_have_sys_procfs_type_win32_pstatus_t" 1>&6
  19297. + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_win32_pstatus_t" >&5
  19298. +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_win32_pstatus_t" >&6
  19299.  
  19300.    fi
  19301.  fi
  19302.  
  19303.  
  19304.  if test -n "$TRAD_HEADER"; then
  19305. -  cat >> confdefs.h <<EOF
  19306. +
  19307. +cat >>confdefs.h <<_ACEOF
  19308.  #define TRAD_HEADER $TRAD_HEADER
  19309. -EOF
  19310. +_ACEOF
  19311.  
  19312.  fi
  19313.  
  19314. @@ -6082,8 +10312,10 @@
  19315.      # use one entry per line, even though this leads to long lines.
  19316.      a29kcoff_big_vec)        tb="$tb coff-a29k.lo cofflink.lo" ;;
  19317.      a_out_adobe_vec)        tb="$tb aout-adobe.lo aout32.lo" ;;
  19318. +    amiga_vec)                  tb="$tb amigaos.lo amigaoslink.lo" ;;
  19319.      aix5coff64_vec)        tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
  19320.      aout0_big_vec)        tb="$tb aout0.lo aout32.lo" ;;
  19321. +    aout_amiga_vec)        tb="$tb aout-amiga.lo aout32.lo";;
  19322.      aout_arm_big_vec)        tb="$tb aout-arm.lo aout32.lo" ;;
  19323.      aout_arm_little_vec)    tb="$tb aout-arm.lo aout32.lo" ;;
  19324.      aout_mips_big_vec)        tb="$tb mipsbsd.lo aout32.lo" ;;
  19325. @@ -6104,6 +10336,7 @@
  19326.      b_out_vec_little_host)    tb="$tb bout.lo aout32.lo" ;;
  19327.      bfd_efi_app_ia32_vec)    tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
  19328.      bfd_efi_app_ia64_vec)    tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
  19329. +    bfd_elf32_amiga_vec)    tb="$tb elf32-amiga.lo elf32.lo $elf" ;;
  19330.      bfd_elf32_avr_vec)        tb="$tb elf32-avr.lo elf32.lo $elf" ;;
  19331.      bfd_elf32_big_generic_vec)     tb="$tb elf32-gen.lo elf32.lo $elf" ;;
  19332.      bfd_elf32_bigarc_vec)    tb="$tb elf32-arc.lo elf32.lo $elf" ;;
  19333. @@ -6122,6 +10355,7 @@
  19334.      bfd_elf32_i370_vec)        tb="$tb elf32-i370.lo elf32.lo $elf" ;;
  19335.      bfd_elf32_i386_freebsd_vec)    tb="$tb elf32-i386.lo elf32.lo $elf" ;;
  19336.      bfd_elf32_i386_vec)        tb="$tb elf32-i386.lo elf32.lo $elf" ;;
  19337. +    bfd_elf32_i386be_amithlon_vec) tb="$tb elf32-i386-amithlon.lo elf32.lo $elf" ;;
  19338.      bfd_elf32_i860_little_vec)    tb="$tb elf32-i860.lo elf32.lo $elf" ;;
  19339.      bfd_elf32_i860_vec)        tb="$tb elf32-i860.lo elf32.lo $elf" ;;
  19340.      bfd_elf32_i960_vec)        tb="$tb elf32-i960.lo elf32.lo $elf" ;;
  19341. @@ -6143,6 +10377,7 @@
  19342.      bfd_elf32_mcore_little_vec)    tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
  19343.      bfd_elf32_mn10200_vec)    tb="$tb elf-m10200.lo elf32.lo $elf" ;;
  19344.      bfd_elf32_mn10300_vec)    tb="$tb elf-m10300.lo elf32.lo $elf" ;;
  19345. +    bfd_elf32_morphos_vec)      tb="$tb elf32-morphos.lo elf32.lo $elf";;
  19346.      bfd_elf32_msp430_vec)    tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
  19347.      bfd_elf32_nbigmips_vec)    tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
  19348.      bfd_elf32_nlittlemips_vec)    tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
  19349. @@ -6326,7 +10561,9 @@
  19350.      cisco_core_little_vec)    tb="$tb cisco-core.lo" ;;
  19351.  
  19352.      "")            ;;
  19353. -    *) { echo "configure: error: *** unknown target vector $vec" 1>&2; exit 1; } ;;
  19354. +    *) { { echo "$as_me:$LINENO: error: *** unknown target vector $vec" >&5
  19355. +echo "$as_me: error: *** unknown target vector $vec" >&2;}
  19356. +   { (exit 1); exit 1; }; } ;;
  19357.      esac
  19358.  
  19359.      if test ${target_size} = 64; then
  19360. @@ -6390,32 +10627,40 @@
  19361.      bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
  19362.      all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
  19363.      if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then
  19364. -      echo "configure: warning: You have requested a 64 bit BFD configuration, but" 1>&2
  19365. -      echo "configure: warning: your compiler may not have a 64 bit integral type" 1>&2
  19366. +      { echo "$as_me:$LINENO: WARNING: You have requested a 64 bit BFD configuration, but" >&5
  19367. +echo "$as_me: WARNING: You have requested a 64 bit BFD configuration, but" >&2;}
  19368. +      { echo "$as_me:$LINENO: WARNING: your compiler may not have a 64 bit integral type" >&5
  19369. +echo "$as_me: WARNING: your compiler may not have a 64 bit integral type" >&2;}
  19370.      fi
  19371.      if test -n "$GCC" ; then
  19372.         bad_64bit_gcc=no;
  19373. -       echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6
  19374. -echo "configure:6400: checking for gcc version with buggy 64-bit support" >&5
  19375. +       echo "$as_me:$LINENO: checking for gcc version with buggy 64-bit support" >&5
  19376. +echo $ECHO_N "checking for gcc version with buggy 64-bit support... $ECHO_C" >&6
  19377.         # Add more tests for gcc versions with non-working 64-bit support here.
  19378. -       cat > conftest.$ac_ext <<EOF
  19379. -#line 6403 "configure"
  19380. -#include "confdefs.h"
  19381. +       cat >conftest.$ac_ext <<_ACEOF
  19382. +#line $LINENO "configure"
  19383. +/* confdefs.h.  */
  19384. +_ACEOF
  19385. +cat confdefs.h >>conftest.$ac_ext
  19386. +cat >>conftest.$ac_ext <<_ACEOF
  19387. +/* end confdefs.h.  */
  19388.  :__GNUC__:__GNUC_MINOR__:__i386__:
  19389. -EOF
  19390. +_ACEOF
  19391.  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  19392. -  egrep ": 2 : 91 : 1 :" >/dev/null 2>&1; then
  19393. -  rm -rf conftest*
  19394. +  $EGREP ": 2 : 91 : 1 :" >/dev/null 2>&1; then
  19395.    bad_64bit_gcc=yes;
  19396. -            echo "$ac_t""yes: egcs-1.1.2 on ix86 spotted" 1>&6
  19397. +            echo "$as_me:$LINENO: result: yes: egcs-1.1.2 on ix86 spotted" >&5
  19398. +echo "${ECHO_T}yes: egcs-1.1.2 on ix86 spotted" >&6
  19399.  else
  19400. -  rm -rf conftest*
  19401. -  echo "$ac_t""no" 1>&6
  19402. +  echo "$as_me:$LINENO: result: no" >&5
  19403. +echo "${ECHO_T}no" >&6
  19404.  fi
  19405.  rm -f conftest*
  19406.  
  19407.         if test $bad_64bit_gcc = yes ; then
  19408. -     { echo "configure: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" 1>&2; exit 1; }
  19409. +     { { echo "$as_me:$LINENO: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" >&5
  19410. +echo "$as_me: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" >&2;}
  19411. +   { (exit 1); exit 1; }; }
  19412.         fi
  19413.      fi
  19414.      ;;
  19415. @@ -6441,112 +10686,251 @@
  19416.  test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
  19417.  
  19418.  
  19419. -for ac_hdr in unistd.h
  19420. +
  19421. +
  19422. +for ac_header in stdlib.h unistd.h
  19423.  do
  19424. -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
  19425. -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
  19426. -echo "configure:6449: checking for $ac_hdr" >&5
  19427. -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  19428. -  echo $ac_n "(cached) $ac_c" 1>&6
  19429. -else
  19430. -  cat > conftest.$ac_ext <<EOF
  19431. -#line 6454 "configure"
  19432. -#include "confdefs.h"
  19433. -#include <$ac_hdr>
  19434. -EOF
  19435. -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  19436. -{ (eval echo configure:6459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  19437. -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  19438. -if test -z "$ac_err"; then
  19439. -  rm -rf conftest*
  19440. -  eval "ac_cv_header_$ac_safe=yes"
  19441. +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
  19442. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  19443. +  echo "$as_me:$LINENO: checking for $ac_header" >&5
  19444. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  19445. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  19446. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19447. +fi
  19448. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  19449. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  19450. +else
  19451. +  # Is the header compilable?
  19452. +echo "$as_me:$LINENO: checking $ac_header usability" >&5
  19453. +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
  19454. +cat >conftest.$ac_ext <<_ACEOF
  19455. +#line $LINENO "configure"
  19456. +/* confdefs.h.  */
  19457. +_ACEOF
  19458. +cat confdefs.h >>conftest.$ac_ext
  19459. +cat >>conftest.$ac_ext <<_ACEOF
  19460. +/* end confdefs.h.  */
  19461. +$ac_includes_default
  19462. +#include <$ac_header>
  19463. +_ACEOF
  19464. +rm -f conftest.$ac_objext
  19465. +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  19466. +  (eval $ac_compile) 2>&5
  19467. +  ac_status=$?
  19468. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19469. +  (exit $ac_status); } &&
  19470. +         { ac_try='test -s conftest.$ac_objext'
  19471. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  19472. +  (eval $ac_try) 2>&5
  19473. +  ac_status=$?
  19474. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19475. +  (exit $ac_status); }; }; then
  19476. +  ac_header_compiler=yes
  19477. +else
  19478. +  echo "$as_me: failed program was:" >&5
  19479. +sed 's/^/| /' conftest.$ac_ext >&5
  19480. +
  19481. +ac_header_compiler=no
  19482. +fi
  19483. +rm -f conftest.$ac_objext conftest.$ac_ext
  19484. +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  19485. +echo "${ECHO_T}$ac_header_compiler" >&6
  19486. +
  19487. +# Is the header present?
  19488. +echo "$as_me:$LINENO: checking $ac_header presence" >&5
  19489. +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
  19490. +cat >conftest.$ac_ext <<_ACEOF
  19491. +#line $LINENO "configure"
  19492. +/* confdefs.h.  */
  19493. +_ACEOF
  19494. +cat confdefs.h >>conftest.$ac_ext
  19495. +cat >>conftest.$ac_ext <<_ACEOF
  19496. +/* end confdefs.h.  */
  19497. +#include <$ac_header>
  19498. +_ACEOF
  19499. +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  19500. +  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  19501. +  ac_status=$?
  19502. +  grep -v '^ *+' conftest.er1 >conftest.err
  19503. +  rm -f conftest.er1
  19504. +  cat conftest.err >&5
  19505. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19506. +  (exit $ac_status); } >/dev/null; then
  19507. +  if test -s conftest.err; then
  19508. +    ac_cpp_err=$ac_c_preproc_warn_flag
  19509. +  else
  19510. +    ac_cpp_err=
  19511. +  fi
  19512. +else
  19513. +  ac_cpp_err=yes
  19514. +fi
  19515. +if test -z "$ac_cpp_err"; then
  19516. +  ac_header_preproc=yes
  19517. +else
  19518. +  echo "$as_me: failed program was:" >&5
  19519. +sed 's/^/| /' conftest.$ac_ext >&5
  19520. +
  19521. +  ac_header_preproc=no
  19522. +fi
  19523. +rm -f conftest.err conftest.$ac_ext
  19524. +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  19525. +echo "${ECHO_T}$ac_header_preproc" >&6
  19526. +
  19527. +# So?  What about this header?
  19528. +case $ac_header_compiler:$ac_header_preproc in
  19529. +  yes:no )
  19530. +    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
  19531. +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
  19532. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  19533. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  19534. +    (
  19535. +      cat <<\_ASBOX
  19536. +## ------------------------------------ ##
  19537. +## Report this to bug-autoconf@gnu.org. ##
  19538. +## ------------------------------------ ##
  19539. +_ASBOX
  19540. +    ) |
  19541. +      sed "s/^/$as_me: WARNING:     /" >&2
  19542. +    ;;
  19543. +  no:yes )
  19544. +    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
  19545. +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
  19546. +    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
  19547. +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
  19548. +    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
  19549. +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
  19550. +    (
  19551. +      cat <<\_ASBOX
  19552. +## ------------------------------------ ##
  19553. +## Report this to bug-autoconf@gnu.org. ##
  19554. +## ------------------------------------ ##
  19555. +_ASBOX
  19556. +    ) |
  19557. +      sed "s/^/$as_me: WARNING:     /" >&2
  19558. +    ;;
  19559. +esac
  19560. +echo "$as_me:$LINENO: checking for $ac_header" >&5
  19561. +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
  19562. +if eval "test \"\${$as_ac_Header+set}\" = set"; then
  19563. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19564.  else
  19565. -  echo "$ac_err" >&5
  19566. -  echo "configure: failed program was:" >&5
  19567. -  cat conftest.$ac_ext >&5
  19568. -  rm -rf conftest*
  19569. -  eval "ac_cv_header_$ac_safe=no"
  19570. +  eval "$as_ac_Header=$ac_header_preproc"
  19571.  fi
  19572. -rm -f conftest*
  19573. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
  19574. +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
  19575. +
  19576.  fi
  19577. -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  19578. -  echo "$ac_t""yes" 1>&6
  19579. -    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  19580. -  cat >> confdefs.h <<EOF
  19581. -#define $ac_tr_hdr 1
  19582. -EOF
  19583. +if test `eval echo '${'$as_ac_Header'}'` = yes; then
  19584. +  cat >>confdefs.h <<_ACEOF
  19585. +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  19586. +_ACEOF
  19587.   
  19588. -else
  19589. -  echo "$ac_t""no" 1>&6
  19590.  fi
  19591. +
  19592.  done
  19593.  
  19594. +
  19595.  for ac_func in getpagesize
  19596.  do
  19597. -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  19598. -echo "configure:6488: checking for $ac_func" >&5
  19599. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  19600. -  echo $ac_n "(cached) $ac_c" 1>&6
  19601. -else
  19602. -  cat > conftest.$ac_ext <<EOF
  19603. -#line 6493 "configure"
  19604. -#include "confdefs.h"
  19605. +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  19606. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  19607. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  19608. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  19609. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19610. +else
  19611. +  cat >conftest.$ac_ext <<_ACEOF
  19612. +#line $LINENO "configure"
  19613. +/* confdefs.h.  */
  19614. +_ACEOF
  19615. +cat confdefs.h >>conftest.$ac_ext
  19616. +cat >>conftest.$ac_ext <<_ACEOF
  19617. +/* end confdefs.h.  */
  19618.  /* System header to define __stub macros and hopefully few prototypes,
  19619. -    which can conflict with char $ac_func(); below.  */
  19620. -#include <assert.h>
  19621. +    which can conflict with char $ac_func (); below.
  19622. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  19623. +    <limits.h> exists even on freestanding compilers.  */
  19624. +#ifdef __STDC__
  19625. +# include <limits.h>
  19626. +#else
  19627. +# include <assert.h>
  19628. +#endif
  19629.  /* Override any gcc2 internal prototype to avoid an error.  */
  19630. +#ifdef __cplusplus
  19631. +extern "C"
  19632. +{
  19633. +#endif
  19634.  /* We use char because int might match the return type of a gcc2
  19635.      builtin and then its argument prototype would still apply.  */
  19636. -char $ac_func();
  19637. -
  19638. -int main() {
  19639. -
  19640. +char $ac_func ();
  19641.  /* The GNU C library defines this for functions which it implements
  19642.      to always fail with ENOSYS.  Some functions are actually named
  19643.      something starting with __ and the normal name is an alias.  */
  19644.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  19645.  choke me
  19646.  #else
  19647. -$ac_func();
  19648. +char (*f) () = $ac_func;
  19649. +#endif
  19650. +#ifdef __cplusplus
  19651. +}
  19652.  #endif
  19653.  
  19654. -; return 0; }
  19655. -EOF
  19656. -if { (eval echo configure:6516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  19657. -  rm -rf conftest*
  19658. -  eval "ac_cv_func_$ac_func=yes"
  19659. -else
  19660. -  echo "configure: failed program was:" >&5
  19661. -  cat conftest.$ac_ext >&5
  19662. -  rm -rf conftest*
  19663. -  eval "ac_cv_func_$ac_func=no"
  19664. -fi
  19665. -rm -f conftest*
  19666. -fi
  19667. -
  19668. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  19669. -  echo "$ac_t""yes" 1>&6
  19670. -    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  19671. -  cat >> confdefs.h <<EOF
  19672. -#define $ac_tr_func 1
  19673. -EOF
  19674. +int
  19675. +main ()
  19676. +{
  19677. +return f != $ac_func;
  19678. +  ;
  19679. +  return 0;
  19680. +}
  19681. +_ACEOF
  19682. +rm -f conftest.$ac_objext conftest$ac_exeext
  19683. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  19684. +  (eval $ac_link) 2>&5
  19685. +  ac_status=$?
  19686. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19687. +  (exit $ac_status); } &&
  19688. +         { ac_try='test -s conftest$ac_exeext'
  19689. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  19690. +  (eval $ac_try) 2>&5
  19691. +  ac_status=$?
  19692. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19693. +  (exit $ac_status); }; }; then
  19694. +  eval "$as_ac_var=yes"
  19695. +else
  19696. +  echo "$as_me: failed program was:" >&5
  19697. +sed 's/^/| /' conftest.$ac_ext >&5
  19698. +
  19699. +eval "$as_ac_var=no"
  19700. +fi
  19701. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  19702. +fi
  19703. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  19704. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  19705. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  19706. +  cat >>confdefs.h <<_ACEOF
  19707. +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  19708. +_ACEOF
  19709.   
  19710. -else
  19711. -  echo "$ac_t""no" 1>&6
  19712.  fi
  19713.  done
  19714.  
  19715. -echo $ac_n "checking for working mmap""... $ac_c" 1>&6
  19716. -echo "configure:6541: checking for working mmap" >&5
  19717. -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
  19718. -  echo $ac_n "(cached) $ac_c" 1>&6
  19719. +echo "$as_me:$LINENO: checking for working mmap" >&5
  19720. +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
  19721. +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
  19722. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19723.  else
  19724.    if test "$cross_compiling" = yes; then
  19725.    ac_cv_func_mmap_fixed_mapped=no
  19726.  else
  19727. -  cat > conftest.$ac_ext <<EOF
  19728. -#line 6549 "configure"
  19729. -#include "confdefs.h"
  19730. +  cat >conftest.$ac_ext <<_ACEOF
  19731. +#line $LINENO "configure"
  19732. +/* confdefs.h.  */
  19733. +_ACEOF
  19734. +cat confdefs.h >>conftest.$ac_ext
  19735. +cat >>conftest.$ac_ext <<_ACEOF
  19736. +/* end confdefs.h.  */
  19737. +$ac_includes_default
  19738. +/* malloc might have been renamed as rpl_malloc. */
  19739. +#undef malloc
  19740.  
  19741.  /* Thanks to Mike Haertel and Jim Avera for this test.
  19742.     Here is a matrix of mmap possibilities:
  19743. @@ -6560,34 +10944,34 @@
  19744.     back from the file, nor mmap's back from the file at a different
  19745.     address.  (There have been systems where private was not correctly
  19746.     implemented like the infamous i386 svr4.0, and systems where the
  19747. -   VM page cache was not coherent with the filesystem buffer cache
  19748. +   VM page cache was not coherent with the file system buffer cache
  19749.     like early versions of FreeBSD and possibly contemporary NetBSD.)
  19750.     For shared mappings, we should conversely verify that changes get
  19751. -   propogated back to all the places they're supposed to be.
  19752. +   propagated back to all the places they're supposed to be.
  19753.  
  19754.     Grep wants private fixed already mapped.
  19755.     The main things grep needs to know about mmap are:
  19756.     * does it exist and is it safe to write into the mmap'd area
  19757.     * how to use it (BSD variants)  */
  19758. -#include <sys/types.h>
  19759. +
  19760.  #include <fcntl.h>
  19761.  #include <sys/mman.h>
  19762.  
  19763. -/* This mess was copied from the GNU getpagesize.h.  */
  19764. -#ifndef HAVE_GETPAGESIZE
  19765. -# ifdef HAVE_UNISTD_H
  19766. -#  include <unistd.h>
  19767. -# endif
  19768. +#if !STDC_HEADERS && !HAVE_STDLIB_H
  19769. +char *malloc ();
  19770. +#endif
  19771.  
  19772. +/* This mess was copied from the GNU getpagesize.h.  */
  19773. +#if !HAVE_GETPAGESIZE
  19774.  /* Assume that all systems that can run configure have sys/param.h.  */
  19775. -# ifndef HAVE_SYS_PARAM_H
  19776. +# if !HAVE_SYS_PARAM_H
  19777.  #  define HAVE_SYS_PARAM_H 1
  19778.  # endif
  19779.  
  19780.  # ifdef _SC_PAGESIZE
  19781.  #  define getpagesize() sysconf(_SC_PAGESIZE)
  19782.  # else /* no _SC_PAGESIZE */
  19783. -#  ifdef HAVE_SYS_PARAM_H
  19784. +#  if HAVE_SYS_PARAM_H
  19785.  #   include <sys/param.h>
  19786.  #   ifdef EXEC_PAGESIZE
  19787.  #    define getpagesize() EXEC_PAGESIZE
  19788. @@ -6614,599 +10998,1556 @@
  19789.  
  19790.  #endif /* no HAVE_GETPAGESIZE */
  19791.  
  19792. -#ifdef __cplusplus
  19793. -extern "C" { void *malloc(unsigned); }
  19794. -#else
  19795. -char *malloc();
  19796. -#endif
  19797. -
  19798.  int
  19799. -main()
  19800. +main ()
  19801.  {
  19802.      char *data, *data2, *data3;
  19803.      int i, pagesize;
  19804.      int fd;
  19805.  
  19806. -    pagesize = getpagesize();
  19807. +  pagesize = getpagesize ();
  19808.  
  19809. -    /*
  19810. -     * First, make a file with some known garbage in it.
  19811. -     */
  19812. -    data = malloc(pagesize);
  19813. +  /* First, make a file with some known garbage in it. */
  19814. +  data = (char *) malloc (pagesize);
  19815.      if (!data)
  19816. -        exit(1);
  19817. +    exit (1);
  19818.      for (i = 0; i < pagesize; ++i)
  19819. -        *(data + i) = rand();
  19820. -    umask(0);
  19821. -    fd = creat("conftestmmap", 0600);
  19822. +    *(data + i) = rand ();
  19823. +  umask (0);
  19824. +  fd = creat ("conftest.mmap", 0600);
  19825.      if (fd < 0)
  19826. -        exit(1);
  19827. -    if (write(fd, data, pagesize) != pagesize)
  19828. -        exit(1);
  19829. -    close(fd);
  19830. -
  19831. -    /*
  19832. -     * Next, try to mmap the file at a fixed address which
  19833. -     * already has something else allocated at it.  If we can,
  19834. -     * also make sure that we see the same garbage.
  19835. -     */
  19836. -    fd = open("conftestmmap", O_RDWR);
  19837. +    exit (1);
  19838. +  if (write (fd, data, pagesize) != pagesize)
  19839. +    exit (1);
  19840. +  close (fd);
  19841. +
  19842. +  /* Next, try to mmap the file at a fixed address which already has
  19843. +     something else allocated at it.  If we can, also make sure that
  19844. +     we see the same garbage.  */
  19845. +  fd = open ("conftest.mmap", O_RDWR);
  19846.      if (fd < 0)
  19847. -        exit(1);
  19848. -    data2 = malloc(2 * pagesize);
  19849. +    exit (1);
  19850. +  data2 = (char *) malloc (2 * pagesize);
  19851.      if (!data2)
  19852. -        exit(1);
  19853. +    exit (1);
  19854.      data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
  19855. -    if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
  19856. +  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
  19857.          MAP_PRIVATE | MAP_FIXED, fd, 0L))
  19858. -        exit(1);
  19859. +    exit (1);
  19860.      for (i = 0; i < pagesize; ++i)
  19861.          if (*(data + i) != *(data2 + i))
  19862. -            exit(1);
  19863. +      exit (1);
  19864.  
  19865. -    /*
  19866. -     * Finally, make sure that changes to the mapped area
  19867. -     * do not percolate back to the file as seen by read().
  19868. -     * (This is a bug on some variants of i386 svr4.0.)
  19869. -     */
  19870. +  /* Finally, make sure that changes to the mapped area do not
  19871. +     percolate back to the file as seen by read().  (This is a bug on
  19872. +     some variants of i386 svr4.0.)  */
  19873.      for (i = 0; i < pagesize; ++i)
  19874.          *(data2 + i) = *(data2 + i) + 1;
  19875. -    data3 = malloc(pagesize);
  19876. +  data3 = (char *) malloc (pagesize);
  19877.      if (!data3)
  19878. -        exit(1);
  19879. -    if (read(fd, data3, pagesize) != pagesize)
  19880. -        exit(1);
  19881. +    exit (1);
  19882. +  if (read (fd, data3, pagesize) != pagesize)
  19883. +    exit (1);
  19884.      for (i = 0; i < pagesize; ++i)
  19885. -        if (*(data + i) != *(data3 + i))
  19886. -            exit(1);
  19887. -    close(fd);
  19888. -    unlink("conftestmmap");
  19889. -    exit(0);
  19890. -}
  19891. -
  19892. -EOF
  19893. -if { (eval echo configure:6689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  19894. -then
  19895. +    if (*(data + i) != *(data3 + i))
  19896. +      exit (1);
  19897. +  close (fd);
  19898. +  exit (0);
  19899. +}
  19900. +_ACEOF
  19901. +rm -f conftest$ac_exeext
  19902. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  19903. +  (eval $ac_link) 2>&5
  19904. +  ac_status=$?
  19905. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19906. +  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  19907. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  19908. +  (eval $ac_try) 2>&5
  19909. +  ac_status=$?
  19910. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  19911. +  (exit $ac_status); }; }; then
  19912.    ac_cv_func_mmap_fixed_mapped=yes
  19913.  else
  19914. -  echo "configure: failed program was:" >&5
  19915. -  cat conftest.$ac_ext >&5
  19916. -  rm -fr conftest*
  19917. -  ac_cv_func_mmap_fixed_mapped=no
  19918. +  echo "$as_me: program exited with status $ac_status" >&5
  19919. +echo "$as_me: failed program was:" >&5
  19920. +sed 's/^/| /' conftest.$ac_ext >&5
  19921. +
  19922. +( exit $ac_status )
  19923. +ac_cv_func_mmap_fixed_mapped=no
  19924.  fi
  19925. -rm -fr conftest*
  19926. +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
  19927.  fi
  19928. -
  19929.  fi
  19930. -
  19931. -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
  19932. +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
  19933. +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
  19934.  if test $ac_cv_func_mmap_fixed_mapped = yes; then
  19935. -  cat >> confdefs.h <<\EOF
  19936. +
  19937. +cat >>confdefs.h <<\_ACEOF
  19938.  #define HAVE_MMAP 1
  19939. -EOF
  19940. +_ACEOF
  19941.  
  19942.  fi
  19943. +rm -f conftest.mmap
  19944. +
  19945. +
  19946.  
  19947.  for ac_func in madvise mprotect
  19948.  do
  19949. -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
  19950. -echo "configure:6714: checking for $ac_func" >&5
  19951. -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  19952. -  echo $ac_n "(cached) $ac_c" 1>&6
  19953. -else
  19954. -  cat > conftest.$ac_ext <<EOF
  19955. -#line 6719 "configure"
  19956. -#include "confdefs.h"
  19957. +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  19958. +echo "$as_me:$LINENO: checking for $ac_func" >&5
  19959. +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  19960. +if eval "test \"\${$as_ac_var+set}\" = set"; then
  19961. +  echo $ECHO_N "(cached) $ECHO_C" >&6
  19962. +else
  19963. +  cat >conftest.$ac_ext <<_ACEOF
  19964. +#line $LINENO "configure"
  19965. +/* confdefs.h.  */
  19966. +_ACEOF
  19967. +cat confdefs.h >>conftest.$ac_ext
  19968. +cat >>conftest.$ac_ext <<_ACEOF
  19969. +/* end confdefs.h.  */
  19970.  /* System header to define __stub macros and hopefully few prototypes,
  19971. -    which can conflict with char $ac_func(); below.  */
  19972. -#include <assert.h>
  19973. +    which can conflict with char $ac_func (); below.
  19974. +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  19975. +    <limits.h> exists even on freestanding compilers.  */
  19976. +#ifdef __STDC__
  19977. +# include <limits.h>
  19978. +#else
  19979. +# include <assert.h>
  19980. +#endif
  19981.  /* Override any gcc2 internal prototype to avoid an error.  */
  19982. +#ifdef __cplusplus
  19983. +extern "C"
  19984. +{
  19985. +#endif
  19986.  /* We use char because int might match the return type of a gcc2
  19987.      builtin and then its argument prototype would still apply.  */
  19988. -char $ac_func();
  19989. -
  19990. -int main() {
  19991. -
  19992. +char $ac_func ();
  19993.  /* The GNU C library defines this for functions which it implements
  19994.      to always fail with ENOSYS.  Some functions are actually named
  19995.      something starting with __ and the normal name is an alias.  */
  19996.  #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  19997.  choke me
  19998.  #else
  19999. -$ac_func();
  20000. +char (*f) () = $ac_func;
  20001. +#endif
  20002. +#ifdef __cplusplus
  20003. +}
  20004.  #endif
  20005.  
  20006. -; return 0; }
  20007. -EOF
  20008. -if { (eval echo configure:6742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  20009. -  rm -rf conftest*
  20010. -  eval "ac_cv_func_$ac_func=yes"
  20011. -else
  20012. -  echo "configure: failed program was:" >&5
  20013. -  cat conftest.$ac_ext >&5
  20014. -  rm -rf conftest*
  20015. -  eval "ac_cv_func_$ac_func=no"
  20016. -fi
  20017. -rm -f conftest*
  20018. -fi
  20019. -
  20020. -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  20021. -  echo "$ac_t""yes" 1>&6
  20022. -    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  20023. -  cat >> confdefs.h <<EOF
  20024. -#define $ac_tr_func 1
  20025. -EOF
  20026. +int
  20027. +main ()
  20028. +{
  20029. +return f != $ac_func;
  20030. +  ;
  20031. +  return 0;
  20032. +}
  20033. +_ACEOF
  20034. +rm -f conftest.$ac_objext conftest$ac_exeext
  20035. +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  20036. +  (eval $ac_link) 2>&5
  20037. +  ac_status=$?
  20038. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  20039. +  (exit $ac_status); } &&
  20040. +         { ac_try='test -s conftest$ac_exeext'
  20041. +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  20042. +  (eval $ac_try) 2>&5
  20043. +  ac_status=$?
  20044. +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  20045. +  (exit $ac_status); }; }; then
  20046. +  eval "$as_ac_var=yes"
  20047. +else
  20048. +  echo "$as_me: failed program was:" >&5
  20049. +sed 's/^/| /' conftest.$ac_ext >&5
  20050. +
  20051. +eval "$as_ac_var=no"
  20052. +fi
  20053. +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
  20054. +fi
  20055. +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  20056. +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  20057. +if test `eval echo '${'$as_ac_var'}'` = yes; then
  20058. +  cat >>confdefs.h <<_ACEOF
  20059. +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  20060. +_ACEOF
  20061.   
  20062. -else
  20063. -  echo "$ac_t""no" 1>&6
  20064.  fi
  20065.  done
  20066.  
  20067.  case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
  20068. -  true+yes )  cat >> confdefs.h <<\EOF
  20069. +  true+yes )
  20070. +cat >>confdefs.h <<\_ACEOF
  20071.  #define USE_MMAP 1
  20072. -EOF
  20073. +_ACEOF
  20074.   ;;
  20075.  esac
  20076.  
  20077.  rm -f doc/config.status
  20078. -trap '' 1 2 15
  20079. -cat > confcache <<\EOF
  20080. +                                                  ac_config_files="$ac_config_files Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in"
  20081. +          ac_config_commands="$ac_config_commands default"
  20082. +cat >confcache <<\_ACEOF
  20083.  # This file is a shell script that caches the results of configure
  20084.  # tests run on this system so they can be shared between configure
  20085. -# scripts and configure runs.  It is not useful on other systems.
  20086. -# If it contains results you don't want to keep, you may remove or edit it.
  20087. +# scripts and configure runs, see configure's option --config-cache.
  20088. +# It is not useful on other systems.  If it contains results you don't
  20089. +# want to keep, you may remove or edit it.
  20090.  #
  20091. -# By default, configure uses ./config.cache as the cache file,
  20092. -# creating it if it does not exist already.  You can give configure
  20093. -# the --cache-file=FILE option to use a different cache file; that is
  20094. -# what configure does when it calls configure scripts in
  20095. -# subdirectories, so they share the cache.
  20096. -# Giving --cache-file=/dev/null disables caching, for debugging configure.
  20097. -# config.status only pays attention to the cache file if you give it the
  20098. -# --recheck option to rerun configure.
  20099. +# config.status only pays attention to the cache file if you give it
  20100. +# the --recheck option to rerun configure.
  20101.  #
  20102. -EOF
  20103. +# `ac_cv_env_foo' variables (set or unset) will be overridden when
  20104. +# loading this file, other *unset* `ac_cv_foo' will be assigned the
  20105. +# following values.
  20106. +
  20107. +_ACEOF
  20108. +
  20109.  # The following way of writing the cache mishandles newlines in values,
  20110.  # but we know of no workaround that is simple, portable, and efficient.
  20111.  # So, don't put newlines in cache variables' values.
  20112.  # Ultrix sh set writes to stderr and can't be redirected directly,
  20113.  # and sets the high bit in the cache file unless we assign to the vars.
  20114. -(set) 2>&1 |
  20115. +{
  20116. +  (set) 2>&1 |
  20117.    case `(ac_space=' '; set | grep ac_space) 2>&1` in
  20118.    *ac_space=\ *)
  20119. -    # `set' does not quote correctly, so add quotes (double-quote substitution
  20120. -    # turns \\\\ into \\, and sed turns \\ into \).
  20121. +      # `set' does not quote correctly, so add quotes (double-quote
  20122. +      # substitution turns \\\\ into \\, and sed turns \\ into \).
  20123.      sed -n \
  20124. -      -e "s/'/'\\\\''/g" \
  20125. -      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
  20126. +        "s/'/'\\\\''/g;
  20127. +          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
  20128.      ;;
  20129.    *)
  20130.      # `set' quotes correctly as required by POSIX, so do not add quotes.
  20131. -    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
  20132. +      sed -n \
  20133. +        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
  20134.      ;;
  20135. -  esac >> confcache
  20136. -if cmp -s $cache_file confcache; then
  20137. -  :
  20138. -else
  20139. +    esac;
  20140. +} |
  20141. +  sed '
  20142. +     t clear
  20143. +     : clear
  20144. +     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
  20145. +     t end
  20146. +     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
  20147. +     : end' >>confcache
  20148. +if diff $cache_file confcache >/dev/null 2>&1; then :; else
  20149.    if test -w $cache_file; then
  20150. -    echo "updating cache $cache_file"
  20151. -    cat confcache > $cache_file
  20152. +    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
  20153. +    cat confcache >$cache_file
  20154.    else
  20155.      echo "not updating unwritable cache $cache_file"
  20156.    fi
  20157.  fi
  20158.  rm -f confcache
  20159.  
  20160. -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
  20161. -
  20162.  test "x$prefix" = xNONE && prefix=$ac_default_prefix
  20163.  # Let make expand exec_prefix.
  20164.  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  20165.  
  20166. -# Any assignment to VPATH causes Sun make to only execute
  20167. -# the first set of double-colon rules, so remove it if not needed.
  20168. -# If there is a colon in the path, we need to keep it.
  20169. +# VPATH may cause trouble with some makes, so we remove $(srcdir),
  20170. +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
  20171. +# trailing colons and then remove the whole line if VPATH becomes empty
  20172. +# (actually we leave an empty line to preserve line numbers).
  20173.  if test "x$srcdir" = x.; then
  20174. -  ac_vpsub='/^[     ]*VPATH[     ]*=[^:]*$/d'
  20175. +  ac_vpsub='/^[     ]*VPATH[     ]*=/{
  20176. +s/:*\$(srcdir):*/:/;
  20177. +s/:*\${srcdir}:*/:/;
  20178. +s/:*@srcdir@:*/:/;
  20179. +s/^\([^=]*=[     ]*\):*/\1/;
  20180. +s/:*$//;
  20181. +s/^[^=]*=[     ]*$//;
  20182. +}'
  20183.  fi
  20184.  
  20185. -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
  20186. -
  20187.  DEFS=-DHAVE_CONFIG_H
  20188.  
  20189. -# Without the "./", some shells look in PATH for config.status.
  20190. -: ${CONFIG_STATUS=./config.status}
  20191. +ac_libobjs=
  20192. +ac_ltlibobjs=
  20193. +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
  20194. +  # 1. Remove the extension, and $U if already installed.
  20195. +  ac_i=`echo "$ac_i" |
  20196. +         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
  20197. +  # 2. Add them.
  20198. +  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
  20199. +  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
  20200. +done
  20201. +LIBOBJS=$ac_libobjs
  20202.  
  20203. -echo creating $CONFIG_STATUS
  20204. -rm -f $CONFIG_STATUS
  20205. -cat > $CONFIG_STATUS <<EOF
  20206. -#! /bin/sh
  20207. -# Generated automatically by configure.
  20208. +LTLIBOBJS=$ac_ltlibobjs
  20209. +
  20210. +
  20211. +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
  20212. +  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
  20213. +Usually this means the macro was only invoked conditionally." >&5
  20214. +echo "$as_me: error: conditional \"AMDEP\" was never defined.
  20215. +Usually this means the macro was only invoked conditionally." >&2;}
  20216. +   { (exit 1); exit 1; }; }
  20217. +fi
  20218. +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
  20219. +  { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
  20220. +Usually this means the macro was only invoked conditionally." >&5
  20221. +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
  20222. +Usually this means the macro was only invoked conditionally." >&2;}
  20223. +   { (exit 1); exit 1; }; }
  20224. +fi
  20225. +if test -z "${INSTALL_LIBBFD_TRUE}" && test -z "${INSTALL_LIBBFD_FALSE}"; then
  20226. +  { { echo "$as_me:$LINENO: error: conditional \"INSTALL_LIBBFD\" was never defined.
  20227. +Usually this means the macro was only invoked conditionally." >&5
  20228. +echo "$as_me: error: conditional \"INSTALL_LIBBFD\" was never defined.
  20229. +Usually this means the macro was only invoked conditionally." >&2;}
  20230. +   { (exit 1); exit 1; }; }
  20231. +fi
  20232. +
  20233. +: ${CONFIG_STATUS=./config.status}
  20234. +ac_clean_files_save=$ac_clean_files
  20235. +ac_clean_files="$ac_clean_files $CONFIG_STATUS"
  20236. +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
  20237. +echo "$as_me: creating $CONFIG_STATUS" >&6;}
  20238. +cat >$CONFIG_STATUS <<_ACEOF
  20239. +#! $SHELL
  20240. +# Generated by $as_me.
  20241.  # Run this file to recreate the current configuration.
  20242. -# This directory was configured as follows,
  20243. -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  20244. -#
  20245. -# $0 $ac_configure_args
  20246. -#
  20247.  # Compiler output produced by configure, useful for debugging
  20248. -# configure, is in ./config.log if it exists.
  20249. +# configure, is in config.log if it exists.
  20250.  
  20251. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
  20252. -for ac_option
  20253. +debug=false
  20254. +ac_cs_recheck=false
  20255. +ac_cs_silent=false
  20256. +SHELL=\${CONFIG_SHELL-$SHELL}
  20257. +_ACEOF
  20258. +
  20259. +cat >>$CONFIG_STATUS <<\_ACEOF
  20260. +## --------------------- ##
  20261. +## M4sh Initialization.  ##
  20262. +## --------------------- ##
  20263. +
  20264. +# Be Bourne compatible
  20265. +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  20266. +  emulate sh
  20267. +  NULLCMD=:
  20268. +  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  20269. +  # is contrary to our usage.  Disable this feature.
  20270. +  alias -g '${1+"$@"}'='"$@"'
  20271. +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
  20272. +  set -o posix
  20273. +fi
  20274. +
  20275. +# Support unset when possible.
  20276. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
  20277. +  as_unset=unset
  20278. +else
  20279. +  as_unset=false
  20280. +fi
  20281. +
  20282. +
  20283. +# Work around bugs in pre-3.0 UWIN ksh.
  20284. +$as_unset ENV MAIL MAILPATH
  20285. +PS1='$ '
  20286. +PS2='> '
  20287. +PS4='+ '
  20288. +
  20289. +# NLS nuisances.
  20290. +for as_var in \
  20291. +  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
  20292. +  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
  20293. +  LC_TELEPHONE LC_TIME
  20294. +do
  20295. +  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
  20296. +    eval $as_var=C; export $as_var
  20297. +  else
  20298. +    $as_unset $as_var
  20299. +  fi
  20300. +done
  20301. +
  20302. +# Required to use basename.
  20303. +if expr a : '\(a\)' >/dev/null 2>&1; then
  20304. +  as_expr=expr
  20305. +else
  20306. +  as_expr=false
  20307. +fi
  20308. +
  20309. +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
  20310. +  as_basename=basename
  20311. +else
  20312. +  as_basename=false
  20313. +fi
  20314. +
  20315. +
  20316. +# Name of the executable.
  20317. +as_me=`$as_basename "$0" ||
  20318. +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
  20319. +     X"$0" : 'X\(//\)$' \| \
  20320. +     X"$0" : 'X\(/\)$' \| \
  20321. +     .     : '\(.\)' 2>/dev/null ||
  20322. +echo X/"$0" |
  20323. +    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
  20324. +        /^X\/\(\/\/\)$/{ s//\1/; q; }
  20325. +        /^X\/\(\/\).*/{ s//\1/; q; }
  20326. +        s/.*/./; q'`
  20327. +
  20328. +
  20329. +# PATH needs CR, and LINENO needs CR and PATH.
  20330. +# Avoid depending upon Character Ranges.
  20331. +as_cr_letters='abcdefghijklmnopqrstuvwxyz'
  20332. +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  20333. +as_cr_Letters=$as_cr_letters$as_cr_LETTERS
  20334. +as_cr_digits='0123456789'
  20335. +as_cr_alnum=$as_cr_Letters$as_cr_digits
  20336. +
  20337. +# The user is always right.
  20338. +if test "${PATH_SEPARATOR+set}" != set; then
  20339. +  echo "#! /bin/sh" >conf$$.sh
  20340. +  echo  "exit 0"   >>conf$$.sh
  20341. +  chmod +x conf$$.sh
  20342. +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
  20343. +    PATH_SEPARATOR=';'
  20344. +  else
  20345. +    PATH_SEPARATOR=:
  20346. +  fi
  20347. +  rm -f conf$$.sh
  20348. +fi
  20349. +
  20350. +
  20351. +  as_lineno_1=$LINENO
  20352. +  as_lineno_2=$LINENO
  20353. +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  20354. +  test "x$as_lineno_1" != "x$as_lineno_2" &&
  20355. +  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
  20356. +  # Find who we are.  Look in the path if we contain no path at all
  20357. +  # relative or not.
  20358. +  case $0 in
  20359. +    *[\\/]* ) as_myself=$0 ;;
  20360. +    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  20361. +for as_dir in $PATH
  20362. +do
  20363. +  IFS=$as_save_IFS
  20364. +  test -z "$as_dir" && as_dir=.
  20365. +  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
  20366. +done
  20367. +
  20368. +       ;;
  20369. +  esac
  20370. +  # We did not find ourselves, most probably we were run as `sh COMMAND'
  20371. +  # in which case we are not to be found in the path.
  20372. +  if test "x$as_myself" = x; then
  20373. +    as_myself=$0
  20374. +  fi
  20375. +  if test ! -f "$as_myself"; then
  20376. +    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
  20377. +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
  20378. +   { (exit 1); exit 1; }; }
  20379. +  fi
  20380. +  case $CONFIG_SHELL in
  20381. +  '')
  20382. +    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  20383. +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
  20384. +do
  20385. +  IFS=$as_save_IFS
  20386. +  test -z "$as_dir" && as_dir=.
  20387. +  for as_base in sh bash ksh sh5; do
  20388. +     case $as_dir in
  20389. +     /*)
  20390. +       if ("$as_dir/$as_base" -c '
  20391. +  as_lineno_1=$LINENO
  20392. +  as_lineno_2=$LINENO
  20393. +  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  20394. +  test "x$as_lineno_1" != "x$as_lineno_2" &&
  20395. +  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
  20396. +         $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
  20397. +         $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
  20398. +         CONFIG_SHELL=$as_dir/$as_base
  20399. +         export CONFIG_SHELL
  20400. +         exec "$CONFIG_SHELL" "$0" ${1+"$@"}
  20401. +       fi;;
  20402. +     esac
  20403. +       done
  20404. +done
  20405. +;;
  20406. +  esac
  20407. +
  20408. +  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
  20409. +  # uniformly replaced by the line number.  The first 'sed' inserts a
  20410. +  # line-number line before each line; the second 'sed' does the real
  20411. +  # work.  The second script uses 'N' to pair each line-number line
  20412. +  # with the numbered line, and appends trailing '-' during
  20413. +  # substitution so that $LINENO is not a special case at line end.
  20414. +  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
  20415. +  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
  20416. +  sed '=' <$as_myself |
  20417. +    sed '
  20418. +      N
  20419. +      s,$,-,
  20420. +      : loop
  20421. +      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
  20422. +      t loop
  20423. +      s,-$,,
  20424. +      s,^['$as_cr_digits']*\n,,
  20425. +    ' >$as_me.lineno &&
  20426. +  chmod +x $as_me.lineno ||
  20427. +    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
  20428. +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
  20429. +   { (exit 1); exit 1; }; }
  20430. +
  20431. +  # Don't try to exec as it changes $[0], causing all sort of problems
  20432. +  # (the dirname of $[0] is not the place where we might find the
  20433. +  # original and so on.  Autoconf is especially sensible to this).
  20434. +  . ./$as_me.lineno
  20435. +  # Exit status is that of the last command.
  20436. +  exit
  20437. +}
  20438. +
  20439. +
  20440. +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
  20441. +  *c*,-n*) ECHO_N= ECHO_C='
  20442. +' ECHO_T='    ' ;;
  20443. +  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
  20444. +  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
  20445. +esac
  20446. +
  20447. +if expr a : '\(a\)' >/dev/null 2>&1; then
  20448. +  as_expr=expr
  20449. +else
  20450. +  as_expr=false
  20451. +fi
  20452. +
  20453. +rm -f conf$$ conf$$.exe conf$$.file
  20454. +echo >conf$$.file
  20455. +if ln -s conf$$.file conf$$ 2>/dev/null; then
  20456. +  # We could just check for DJGPP; but this test a) works b) is more generic
  20457. +  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
  20458. +  if test -f conf$$.exe; then
  20459. +    # Don't use ln at all; we don't have any links
  20460. +    as_ln_s='cp -p'
  20461. +  else
  20462. +    as_ln_s='ln -s'
  20463. +  fi
  20464. +elif ln conf$$.file conf$$ 2>/dev/null; then
  20465. +  as_ln_s=ln
  20466. +else
  20467. +  as_ln_s='cp -p'
  20468. +fi
  20469. +rm -f conf$$ conf$$.exe conf$$.file
  20470. +
  20471. +if mkdir -p . 2>/dev/null; then
  20472. +  as_mkdir_p=:
  20473. +else
  20474. +  as_mkdir_p=false
  20475. +fi
  20476. +
  20477. +as_executable_p="test -f"
  20478. +
  20479. +# Sed expression to map a string onto a valid CPP name.
  20480. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
  20481. +
  20482. +# Sed expression to map a string onto a valid variable name.
  20483. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
  20484. +
  20485. +
  20486. +# IFS
  20487. +# We need space, tab and new line, in precisely that order.
  20488. +as_nl='
  20489. +'
  20490. +IFS="     $as_nl"
  20491. +
  20492. +# CDPATH.
  20493. +$as_unset CDPATH
  20494. +
  20495. +exec 6>&1
  20496. +
  20497. +# Open the log real soon, to keep \$[0] and so on meaningful, and to
  20498. +# report actual input values of CONFIG_FILES etc. instead of their
  20499. +# values after options handling.  Logging --version etc. is OK.
  20500. +exec 5>>config.log
  20501. +{
  20502. +  echo
  20503. +  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
  20504. +## Running $as_me. ##
  20505. +_ASBOX
  20506. +} >&5
  20507. +cat >&5 <<_CSEOF
  20508. +
  20509. +This file was extended by $as_me, which was
  20510. +generated by GNU Autoconf 2.57.  Invocation command line was
  20511. +
  20512. +  CONFIG_FILES    = $CONFIG_FILES
  20513. +  CONFIG_HEADERS  = $CONFIG_HEADERS
  20514. +  CONFIG_LINKS    = $CONFIG_LINKS
  20515. +  CONFIG_COMMANDS = $CONFIG_COMMANDS
  20516. +  $ $0 $@
  20517. +
  20518. +_CSEOF
  20519. +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
  20520. +echo >&5
  20521. +_ACEOF
  20522. +
  20523. +# Files that config.status was made for.
  20524. +if test -n "$ac_config_files"; then
  20525. +  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
  20526. +fi
  20527. +
  20528. +if test -n "$ac_config_headers"; then
  20529. +  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
  20530. +fi
  20531. +
  20532. +if test -n "$ac_config_links"; then
  20533. +  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
  20534. +fi
  20535. +
  20536. +if test -n "$ac_config_commands"; then
  20537. +  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
  20538. +fi
  20539. +
  20540. +cat >>$CONFIG_STATUS <<\_ACEOF
  20541. +
  20542. +ac_cs_usage="\
  20543. +\`$as_me' instantiates files from templates according to the
  20544. +current configuration.
  20545. +
  20546. +Usage: $0 [OPTIONS] [FILE]...
  20547. +
  20548. +  -h, --help       print this help, then exit
  20549. +  -V, --version    print version number, then exit
  20550. +  -q, --quiet      do not print progress messages
  20551. +  -d, --debug      don't remove temporary files
  20552. +      --recheck    update $as_me by reconfiguring in the same conditions
  20553. +  --file=FILE[:TEMPLATE]
  20554. +                   instantiate the configuration file FILE
  20555. +  --header=FILE[:TEMPLATE]
  20556. +                   instantiate the configuration header FILE
  20557. +
  20558. +Configuration files:
  20559. +$config_files
  20560. +
  20561. +Configuration headers:
  20562. +$config_headers
  20563. +
  20564. +Configuration commands:
  20565. +$config_commands
  20566. +
  20567. +Report bugs to <bug-autoconf@gnu.org>."
  20568. +_ACEOF
  20569. +
  20570. +cat >>$CONFIG_STATUS <<_ACEOF
  20571. +ac_cs_version="\\
  20572. +config.status
  20573. +configured by $0, generated by GNU Autoconf 2.57,
  20574. +  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
  20575. +
  20576. +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
  20577. +Free Software Foundation, Inc.
  20578. +This config.status script is free software; the Free Software Foundation
  20579. +gives unlimited permission to copy, distribute and modify it."
  20580. +srcdir=$srcdir
  20581. +INSTALL="$INSTALL"
  20582. +_ACEOF
  20583. +
  20584. +cat >>$CONFIG_STATUS <<\_ACEOF
  20585. +# If no file are specified by the user, then we need to provide default
  20586. +# value.  By we need to know if files were specified by the user.
  20587. +ac_need_defaults=:
  20588. +while test $# != 0
  20589.  do
  20590. -  case "\$ac_option" in
  20591. +  case $1 in
  20592. +  --*=*)
  20593. +    ac_option=`expr "x$1" : 'x\([^=]*\)='`
  20594. +    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
  20595. +    ac_shift=:
  20596. +    ;;
  20597. +  -*)
  20598. +    ac_option=$1
  20599. +    ac_optarg=$2
  20600. +    ac_shift=shift
  20601. +    ;;
  20602. +  *) # This is not an option, so the user has probably given explicit
  20603. +     # arguments.
  20604. +     ac_option=$1
  20605. +     ac_need_defaults=false;;
  20606. +  esac
  20607. +
  20608. +  case $ac_option in
  20609. +  # Handling of the options.
  20610. +_ACEOF
  20611. +cat >>$CONFIG_STATUS <<\_ACEOF
  20612.    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  20613. -    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
  20614. -    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
  20615. -  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
  20616. -    echo "$CONFIG_STATUS generated by autoconf version 2.13"
  20617. -    exit 0 ;;
  20618. -  -help | --help | --hel | --he | --h)
  20619. -    echo "\$ac_cs_usage"; exit 0 ;;
  20620. -  *) echo "\$ac_cs_usage"; exit 1 ;;
  20621. +    ac_cs_recheck=: ;;
  20622. +  --version | --vers* | -V )
  20623. +    echo "$ac_cs_version"; exit 0 ;;
  20624. +  --he | --h)
  20625. +    # Conflict between --help and --header
  20626. +    { { echo "$as_me:$LINENO: error: ambiguous option: $1
  20627. +Try \`$0 --help' for more information." >&5
  20628. +echo "$as_me: error: ambiguous option: $1
  20629. +Try \`$0 --help' for more information." >&2;}
  20630. +   { (exit 1); exit 1; }; };;
  20631. +  --help | --hel | -h )
  20632. +    echo "$ac_cs_usage"; exit 0 ;;
  20633. +  --debug | --d* | -d )
  20634. +    debug=: ;;
  20635. +  --file | --fil | --fi | --f )
  20636. +    $ac_shift
  20637. +    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
  20638. +    ac_need_defaults=false;;
  20639. +  --header | --heade | --head | --hea )
  20640. +    $ac_shift
  20641. +    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
  20642. +    ac_need_defaults=false;;
  20643. +  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  20644. +  | -silent | --silent | --silen | --sile | --sil | --si | --s)
  20645. +    ac_cs_silent=: ;;
  20646. +
  20647. +  # This is an error.
  20648. +  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
  20649. +Try \`$0 --help' for more information." >&5
  20650. +echo "$as_me: error: unrecognized option: $1
  20651. +Try \`$0 --help' for more information." >&2;}
  20652. +   { (exit 1); exit 1; }; } ;;
  20653. +
  20654. +  *) ac_config_targets="$ac_config_targets $1" ;;
  20655. +
  20656.    esac
  20657. +  shift
  20658.  done
  20659.  
  20660. -ac_given_srcdir=$srcdir
  20661. -ac_given_INSTALL="$INSTALL"
  20662. +ac_configure_extra_args=
  20663.  
  20664. -trap 'rm -fr `echo "Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
  20665. -EOF
  20666. -cat >> $CONFIG_STATUS <<EOF
  20667. +if $ac_cs_silent; then
  20668. +  exec 6>/dev/null
  20669. +  ac_configure_extra_args="$ac_configure_extra_args --silent"
  20670. +fi
  20671.  
  20672. -# Protect against being on the right side of a sed subst in config.status.
  20673. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
  20674. - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
  20675. -$ac_vpsub
  20676. -$extrasub
  20677. -s%@SHELL@%$SHELL%g
  20678. -s%@CFLAGS@%$CFLAGS%g
  20679. -s%@CPPFLAGS@%$CPPFLAGS%g
  20680. -s%@CXXFLAGS@%$CXXFLAGS%g
  20681. -s%@FFLAGS@%$FFLAGS%g
  20682. -s%@DEFS@%$DEFS%g
  20683. -s%@LDFLAGS@%$LDFLAGS%g
  20684. -s%@LIBS@%$LIBS%g
  20685. -s%@exec_prefix@%$exec_prefix%g
  20686. -s%@prefix@%$prefix%g
  20687. -s%@program_transform_name@%$program_transform_name%g
  20688. -s%@bindir@%$bindir%g
  20689. -s%@sbindir@%$sbindir%g
  20690. -s%@libexecdir@%$libexecdir%g
  20691. -s%@datadir@%$datadir%g
  20692. -s%@sysconfdir@%$sysconfdir%g
  20693. -s%@sharedstatedir@%$sharedstatedir%g
  20694. -s%@localstatedir@%$localstatedir%g
  20695. -s%@libdir@%$libdir%g
  20696. -s%@includedir@%$includedir%g
  20697. -s%@oldincludedir@%$oldincludedir%g
  20698. -s%@infodir@%$infodir%g
  20699. -s%@mandir@%$mandir%g
  20700. -s%@host@%$host%g
  20701. -s%@host_alias@%$host_alias%g
  20702. -s%@host_cpu@%$host_cpu%g
  20703. -s%@host_vendor@%$host_vendor%g
  20704. -s%@host_os@%$host_os%g
  20705. -s%@target@%$target%g
  20706. -s%@target_alias@%$target_alias%g
  20707. -s%@target_cpu@%$target_cpu%g
  20708. -s%@target_vendor@%$target_vendor%g
  20709. -s%@target_os@%$target_os%g
  20710. -s%@build@%$build%g
  20711. -s%@build_alias@%$build_alias%g
  20712. -s%@build_cpu@%$build_cpu%g
  20713. -s%@build_vendor@%$build_vendor%g
  20714. -s%@build_os@%$build_os%g
  20715. -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  20716. -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
  20717. -s%@INSTALL_DATA@%$INSTALL_DATA%g
  20718. -s%@PACKAGE@%$PACKAGE%g
  20719. -s%@VERSION@%$VERSION%g
  20720. -s%@ACLOCAL@%$ACLOCAL%g
  20721. -s%@AUTOCONF@%$AUTOCONF%g
  20722. -s%@AUTOMAKE@%$AUTOMAKE%g
  20723. -s%@AUTOHEADER@%$AUTOHEADER%g
  20724. -s%@MAKEINFO@%$MAKEINFO%g
  20725. -s%@SET_MAKE@%$SET_MAKE%g
  20726. -s%@bfd_version@%$bfd_version%g
  20727. -s%@bfd_version_string@%$bfd_version_string%g
  20728. -s%@AR@%$AR%g
  20729. -s%@RANLIB@%$RANLIB%g
  20730. -s%@CC@%$CC%g
  20731. -s%@LN_S@%$LN_S%g
  20732. -s%@OBJEXT@%$OBJEXT%g
  20733. -s%@EXEEXT@%$EXEEXT%g
  20734. -s%@STRIP@%$STRIP%g
  20735. -s%@LIBTOOL@%$LIBTOOL%g
  20736. -s%@WARN_CFLAGS@%$WARN_CFLAGS%g
  20737. -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
  20738. -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
  20739. -s%@MAINT@%$MAINT%g
  20740. -s%@INSTALL_LIBBFD_TRUE@%$INSTALL_LIBBFD_TRUE%g
  20741. -s%@INSTALL_LIBBFD_FALSE@%$INSTALL_LIBBFD_FALSE%g
  20742. -s%@bfdlibdir@%$bfdlibdir%g
  20743. -s%@bfdincludedir@%$bfdincludedir%g
  20744. -s%@CPP@%$CPP%g
  20745. -s%@ALLOCA@%$ALLOCA%g
  20746. -s%@USE_NLS@%$USE_NLS%g
  20747. -s%@MSGFMT@%$MSGFMT%g
  20748. -s%@GMSGFMT@%$GMSGFMT%g
  20749. -s%@XGETTEXT@%$XGETTEXT%g
  20750. -s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
  20751. -s%@CATALOGS@%$CATALOGS%g
  20752. -s%@CATOBJEXT@%$CATOBJEXT%g
  20753. -s%@DATADIRNAME@%$DATADIRNAME%g
  20754. -s%@GMOFILES@%$GMOFILES%g
  20755. -s%@INSTOBJEXT@%$INSTOBJEXT%g
  20756. -s%@INTLDEPS@%$INTLDEPS%g
  20757. -s%@INTLLIBS@%$INTLLIBS%g
  20758. -s%@INTLOBJS@%$INTLOBJS%g
  20759. -s%@POFILES@%$POFILES%g
  20760. -s%@POSUB@%$POSUB%g
  20761. -s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
  20762. -s%@GT_NO@%$GT_NO%g
  20763. -s%@GT_YES@%$GT_YES%g
  20764. -s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
  20765. -s%@l@%$l%g
  20766. -s%@HDEFINES@%$HDEFINES%g
  20767. -s%@BFD_HOST_64BIT_LONG@%$BFD_HOST_64BIT_LONG%g
  20768. -s%@BFD_HOST_64_BIT_DEFINED@%$BFD_HOST_64_BIT_DEFINED%g
  20769. -s%@BFD_HOST_64_BIT@%$BFD_HOST_64_BIT%g
  20770. -s%@BFD_HOST_U_64_BIT@%$BFD_HOST_U_64_BIT%g
  20771. -s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
  20772. -s%@EXEEXT_FOR_BUILD@%$EXEEXT_FOR_BUILD%g
  20773. -s%@COREFILE@%$COREFILE%g
  20774. -s%@COREFLAG@%$COREFLAG%g
  20775. -s%@WIN32LDFLAGS@%$WIN32LDFLAGS%g
  20776. -s%@WIN32LIBADD@%$WIN32LIBADD%g
  20777. -s%@TDEFINES@%$TDEFINES%g
  20778. -s%@wordsize@%$wordsize%g
  20779. -s%@bfd_libs@%$bfd_libs%g
  20780. -s%@all_backends@%$all_backends%g
  20781. -s%@bfd_backends@%$bfd_backends%g
  20782. -s%@bfd_machines@%$bfd_machines%g
  20783. -s%@bfd_default_target_size@%$bfd_default_target_size%g
  20784. -s%@tdefaults@%$tdefaults%g
  20785. +_ACEOF
  20786. +cat >>$CONFIG_STATUS <<_ACEOF
  20787. +if \$ac_cs_recheck; then
  20788. +  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
  20789. +  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
  20790. +fi
  20791. +
  20792. +_ACEOF
  20793. +
  20794. +cat >>$CONFIG_STATUS <<_ACEOF
  20795. +#
  20796. +# INIT-COMMANDS section.
  20797. +#
  20798. +
  20799. +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
  20800. +
  20801. +_ACEOF
  20802. +
  20803. +
  20804. +
  20805. +cat >>$CONFIG_STATUS <<\_ACEOF
  20806. +for ac_config_target in $ac_config_targets
  20807. +do
  20808. +  case "$ac_config_target" in
  20809. +  # Handling of arguments.
  20810. +  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
  20811. +  "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
  20812. +  "bfd-in3.h" ) CONFIG_FILES="$CONFIG_FILES bfd-in3.h:bfd-in2.h" ;;
  20813. +  "bfdver.h" ) CONFIG_FILES="$CONFIG_FILES bfdver.h:version.h" ;;
  20814. +  "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in:po/Make-in" ;;
  20815. +  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
  20816. +  "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
  20817. +  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
  20818. +  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
  20819. +echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
  20820. +   { (exit 1); exit 1; }; };;
  20821. +  esac
  20822. +done
  20823. +
  20824. +# If the user did not use the arguments to specify the items to instantiate,
  20825. +# then the envvar interface is used.  Set only those that are not.
  20826. +# We use the long form for the default assignment because of an extremely
  20827. +# bizarre bug on SunOS 4.1.3.
  20828. +if $ac_need_defaults; then
  20829. +  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
  20830. +  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
  20831. +  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
  20832. +fi
  20833. +
  20834. +# Have a temporary directory for convenience.  Make it in the build tree
  20835. +# simply because there is no reason to put it here, and in addition,
  20836. +# creating and moving files from /tmp can sometimes cause problems.
  20837. +# Create a temporary directory, and hook for its removal unless debugging.
  20838. +$debug ||
  20839. +{
  20840. +  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
  20841. +  trap '{ (exit 1); exit 1; }' 1 2 13 15
  20842. +}
  20843. +
  20844. +# Create a (secure) tmp directory for tmp files.
  20845. +
  20846. +{
  20847. +  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
  20848. +  test -n "$tmp" && test -d "$tmp"
  20849. +}  ||
  20850. +{
  20851. +  tmp=./confstat$$-$RANDOM
  20852. +  (umask 077 && mkdir $tmp)
  20853. +} ||
  20854. +{
  20855. +   echo "$me: cannot create a temporary directory in ." >&2
  20856. +   { (exit 1); exit 1; }
  20857. +}
  20858. +
  20859. +_ACEOF
  20860. +
  20861. +cat >>$CONFIG_STATUS <<_ACEOF
  20862.  
  20863. +#
  20864. +# CONFIG_FILES section.
  20865. +#
  20866. +
  20867. +# No need to generate the scripts if there are no CONFIG_FILES.
  20868. +# This happens for instance when ./config.status config.h
  20869. +if test -n "\$CONFIG_FILES"; then
  20870. +  # Protect against being on the right side of a sed subst in config.status.
  20871. +  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
  20872. +   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
  20873. +s,@SHELL@,$SHELL,;t t
  20874. +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
  20875. +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
  20876. +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
  20877. +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
  20878. +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
  20879. +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
  20880. +s,@exec_prefix@,$exec_prefix,;t t
  20881. +s,@prefix@,$prefix,;t t
  20882. +s,@program_transform_name@,$program_transform_name,;t t
  20883. +s,@bindir@,$bindir,;t t
  20884. +s,@sbindir@,$sbindir,;t t
  20885. +s,@libexecdir@,$libexecdir,;t t
  20886. +s,@datadir@,$datadir,;t t
  20887. +s,@sysconfdir@,$sysconfdir,;t t
  20888. +s,@sharedstatedir@,$sharedstatedir,;t t
  20889. +s,@localstatedir@,$localstatedir,;t t
  20890. +s,@libdir@,$libdir,;t t
  20891. +s,@includedir@,$includedir,;t t
  20892. +s,@oldincludedir@,$oldincludedir,;t t
  20893. +s,@infodir@,$infodir,;t t
  20894. +s,@mandir@,$mandir,;t t
  20895. +s,@build_alias@,$build_alias,;t t
  20896. +s,@host_alias@,$host_alias,;t t
  20897. +s,@target_alias@,$target_alias,;t t
  20898. +s,@DEFS@,$DEFS,;t t
  20899. +s,@ECHO_C@,$ECHO_C,;t t
  20900. +s,@ECHO_N@,$ECHO_N,;t t
  20901. +s,@ECHO_T@,$ECHO_T,;t t
  20902. +s,@LIBS@,$LIBS,;t t
  20903. +s,@build@,$build,;t t
  20904. +s,@build_cpu@,$build_cpu,;t t
  20905. +s,@build_vendor@,$build_vendor,;t t
  20906. +s,@build_os@,$build_os,;t t
  20907. +s,@host@,$host,;t t
  20908. +s,@host_cpu@,$host_cpu,;t t
  20909. +s,@host_vendor@,$host_vendor,;t t
  20910. +s,@host_os@,$host_os,;t t
  20911. +s,@target@,$target,;t t
  20912. +s,@target_cpu@,$target_cpu,;t t
  20913. +s,@target_vendor@,$target_vendor,;t t
  20914. +s,@target_os@,$target_os,;t t
  20915. +s,@CC@,$CC,;t t
  20916. +s,@CFLAGS@,$CFLAGS,;t t
  20917. +s,@LDFLAGS@,$LDFLAGS,;t t
  20918. +s,@CPPFLAGS@,$CPPFLAGS,;t t
  20919. +s,@ac_ct_CC@,$ac_ct_CC,;t t
  20920. +s,@EXEEXT@,$EXEEXT,;t t
  20921. +s,@OBJEXT@,$OBJEXT,;t t
  20922. +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
  20923. +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
  20924. +s,@INSTALL_DATA@,$INSTALL_DATA,;t t
  20925. +s,@PACKAGE@,$PACKAGE,;t t
  20926. +s,@VERSION@,$VERSION,;t t
  20927. +s,@ACLOCAL@,$ACLOCAL,;t t
  20928. +s,@AUTOCONF@,$AUTOCONF,;t t
  20929. +s,@AUTOMAKE@,$AUTOMAKE,;t t
  20930. +s,@AUTOHEADER@,$AUTOHEADER,;t t
  20931. +s,@MAKEINFO@,$MAKEINFO,;t t
  20932. +s,@AMTAR@,$AMTAR,;t t
  20933. +s,@install_sh@,$install_sh,;t t
  20934. +s,@STRIP@,$STRIP,;t t
  20935. +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
  20936. +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
  20937. +s,@AWK@,$AWK,;t t
  20938. +s,@SET_MAKE@,$SET_MAKE,;t t
  20939. +s,@DEPDIR@,$DEPDIR,;t t
  20940. +s,@am__include@,$am__include,;t t
  20941. +s,@am__quote@,$am__quote,;t t
  20942. +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
  20943. +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
  20944. +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
  20945. +s,@CCDEPMODE@,$CCDEPMODE,;t t
  20946. +s,@bfd_version@,$bfd_version,;t t
  20947. +s,@bfd_version_string@,$bfd_version_string,;t t
  20948. +s,@AR@,$AR,;t t
  20949. +s,@ac_ct_AR@,$ac_ct_AR,;t t
  20950. +s,@RANLIB@,$RANLIB,;t t
  20951. +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
  20952. +s,@LN_S@,$LN_S,;t t
  20953. +s,@LIBTOOL@,$LIBTOOL,;t t
  20954. +s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t
  20955. +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
  20956. +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
  20957. +s,@MAINT@,$MAINT,;t t
  20958. +s,@INSTALL_LIBBFD_TRUE@,$INSTALL_LIBBFD_TRUE,;t t
  20959. +s,@INSTALL_LIBBFD_FALSE@,$INSTALL_LIBBFD_FALSE,;t t
  20960. +s,@bfdlibdir@,$bfdlibdir,;t t
  20961. +s,@bfdincludedir@,$bfdincludedir,;t t
  20962. +s,@CPP@,$CPP,;t t
  20963. +s,@EGREP@,$EGREP,;t t
  20964. +s,@ALLOCA@,$ALLOCA,;t t
  20965. +s,@USE_NLS@,$USE_NLS,;t t
  20966. +s,@MSGFMT@,$MSGFMT,;t t
  20967. +s,@GMSGFMT@,$GMSGFMT,;t t
  20968. +s,@XGETTEXT@,$XGETTEXT,;t t
  20969. +s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t
  20970. +s,@CATALOGS@,$CATALOGS,;t t
  20971. +s,@CATOBJEXT@,$CATOBJEXT,;t t
  20972. +s,@DATADIRNAME@,$DATADIRNAME,;t t
  20973. +s,@GMOFILES@,$GMOFILES,;t t
  20974. +s,@INSTOBJEXT@,$INSTOBJEXT,;t t
  20975. +s,@INTLDEPS@,$INTLDEPS,;t t
  20976. +s,@INTLLIBS@,$INTLLIBS,;t t
  20977. +s,@INTLOBJS@,$INTLOBJS,;t t
  20978. +s,@POFILES@,$POFILES,;t t
  20979. +s,@POSUB@,$POSUB,;t t
  20980. +s,@INCLUDE_LOCALE_H@,$INCLUDE_LOCALE_H,;t t
  20981. +s,@GT_NO@,$GT_NO,;t t
  20982. +s,@GT_YES@,$GT_YES,;t t
  20983. +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
  20984. +s,@l@,$l,;t t
  20985. +s,@HDEFINES@,$HDEFINES,;t t
  20986. +s,@BFD_HOST_64BIT_LONG@,$BFD_HOST_64BIT_LONG,;t t
  20987. +s,@BFD_HOST_64_BIT_DEFINED@,$BFD_HOST_64_BIT_DEFINED,;t t
  20988. +s,@BFD_HOST_64_BIT@,$BFD_HOST_64_BIT,;t t
  20989. +s,@BFD_HOST_U_64_BIT@,$BFD_HOST_U_64_BIT,;t t
  20990. +s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t
  20991. +s,@EXEEXT_FOR_BUILD@,$EXEEXT_FOR_BUILD,;t t
  20992. +s,@COREFILE@,$COREFILE,;t t
  20993. +s,@COREFLAG@,$COREFLAG,;t t
  20994. +s,@WIN32LDFLAGS@,$WIN32LDFLAGS,;t t
  20995. +s,@WIN32LIBADD@,$WIN32LIBADD,;t t
  20996. +s,@TDEFINES@,$TDEFINES,;t t
  20997. +s,@wordsize@,$wordsize,;t t
  20998. +s,@bfd_libs@,$bfd_libs,;t t
  20999. +s,@all_backends@,$all_backends,;t t
  21000. +s,@bfd_backends@,$bfd_backends,;t t
  21001. +s,@bfd_machines@,$bfd_machines,;t t
  21002. +s,@bfd_default_target_size@,$bfd_default_target_size,;t t
  21003. +s,@tdefaults@,$tdefaults,;t t
  21004. +s,@LIBOBJS@,$LIBOBJS,;t t
  21005. +s,@LTLIBOBJS@,$LTLIBOBJS,;t t
  21006.  CEOF
  21007. -EOF
  21008.  
  21009. -cat >> $CONFIG_STATUS <<\EOF
  21010. +_ACEOF
  21011.  
  21012. -# Split the substitutions into bite-sized pieces for seds with
  21013. -# small command number limits, like on Digital OSF/1 and HP-UX.
  21014. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
  21015. -ac_file=1 # Number of current file.
  21016. -ac_beg=1 # First line for current file.
  21017. -ac_end=$ac_max_sed_cmds # Line after last line for current file.
  21018. -ac_more_lines=:
  21019. -ac_sed_cmds=""
  21020. -while $ac_more_lines; do
  21021. +  cat >>$CONFIG_STATUS <<\_ACEOF
  21022. +  # Split the substitutions into bite-sized pieces for seds with
  21023. +  # small command number limits, like on Digital OSF/1 and HP-UX.
  21024. +  ac_max_sed_lines=48
  21025. +  ac_sed_frag=1 # Number of current file.
  21026. +  ac_beg=1 # First line for current file.
  21027. +  ac_end=$ac_max_sed_lines # Line after last line for current file.
  21028. +  ac_more_lines=:
  21029. +  ac_sed_cmds=
  21030. +  while $ac_more_lines; do
  21031.    if test $ac_beg -gt 1; then
  21032. -    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
  21033. +      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
  21034.    else
  21035. -    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
  21036. +      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
  21037.    fi
  21038. -  if test ! -s conftest.s$ac_file; then
  21039. +    if test ! -s $tmp/subs.frag; then
  21040.      ac_more_lines=false
  21041. -    rm -f conftest.s$ac_file
  21042.    else
  21043. +      # The purpose of the label and of the branching condition is to
  21044. +      # speed up the sed processing (if there are no `@' at all, there
  21045. +      # is no need to browse any of the substitutions).
  21046. +      # These are the two extra sed commands mentioned above.
  21047. +      (echo ':t
  21048. +  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
  21049.      if test -z "$ac_sed_cmds"; then
  21050. -      ac_sed_cmds="sed -f conftest.s$ac_file"
  21051. +      ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
  21052.      else
  21053. -      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
  21054. +      ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
  21055.      fi
  21056. -    ac_file=`expr $ac_file + 1`
  21057. +      ac_sed_frag=`expr $ac_sed_frag + 1`
  21058.      ac_beg=$ac_end
  21059. -    ac_end=`expr $ac_end + $ac_max_sed_cmds`
  21060. +      ac_end=`expr $ac_end + $ac_max_sed_lines`
  21061.    fi
  21062. -done
  21063. -if test -z "$ac_sed_cmds"; then
  21064. +  done
  21065. +  if test -z "$ac_sed_cmds"; then
  21066.    ac_sed_cmds=cat
  21067. -fi
  21068. -EOF
  21069. -
  21070. -cat >> $CONFIG_STATUS <<EOF
  21071. +  fi
  21072. +fi # test -n "$CONFIG_FILES"
  21073.  
  21074. -CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in"}
  21075. -EOF
  21076. -cat >> $CONFIG_STATUS <<\EOF
  21077. -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  21078. +_ACEOF
  21079. +cat >>$CONFIG_STATUS <<\_ACEOF
  21080. +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
  21081.    # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
  21082. -  case "$ac_file" in
  21083. -  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
  21084. -       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  21085. -  *) ac_file_in="${ac_file}.in" ;;
  21086. -  esac
  21087. +  case $ac_file in
  21088. +  - | *:- | *:-:* ) # input from stdin
  21089. +        cat >$tmp/stdin
  21090. +        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
  21091. +        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  21092. +  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
  21093. +        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  21094. +  * )   ac_file_in=$ac_file.in ;;
  21095. +  esac
  21096. +
  21097. +  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
  21098. +  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
  21099. +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21100. +         X"$ac_file" : 'X\(//\)[^/]' \| \
  21101. +         X"$ac_file" : 'X\(//\)$' \| \
  21102. +         X"$ac_file" : 'X\(/\)' \| \
  21103. +         .     : '\(.\)' 2>/dev/null ||
  21104. +echo X"$ac_file" |
  21105. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21106. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21107. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21108. +        /^X\(\/\).*/{ s//\1/; q; }
  21109. +        s/.*/./; q'`
  21110. +  { if $as_mkdir_p; then
  21111. +    mkdir -p "$ac_dir"
  21112. +  else
  21113. +    as_dir="$ac_dir"
  21114. +    as_dirs=
  21115. +    while test ! -d "$as_dir"; do
  21116. +      as_dirs="$as_dir $as_dirs"
  21117. +      as_dir=`(dirname "$as_dir") 2>/dev/null ||
  21118. +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21119. +         X"$as_dir" : 'X\(//\)[^/]' \| \
  21120. +         X"$as_dir" : 'X\(//\)$' \| \
  21121. +         X"$as_dir" : 'X\(/\)' \| \
  21122. +         .     : '\(.\)' 2>/dev/null ||
  21123. +echo X"$as_dir" |
  21124. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21125. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21126. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21127. +        /^X\(\/\).*/{ s//\1/; q; }
  21128. +        s/.*/./; q'`
  21129. +    done
  21130. +    test ! -n "$as_dirs" || mkdir $as_dirs
  21131. +  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
  21132. +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
  21133. +   { (exit 1); exit 1; }; }; }
  21134. +
  21135. +  ac_builddir=.
  21136.  
  21137. -  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
  21138. -
  21139. -  # Remove last slash and all that follows it.  Not all systems have dirname.
  21140. -  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  21141. -  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
  21142. -    # The file is in a subdirectory.
  21143. -    test ! -d "$ac_dir" && mkdir "$ac_dir"
  21144. -    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
  21145. +if test "$ac_dir" != .; then
  21146. +  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
  21147.      # A "../" for each directory in $ac_dir_suffix.
  21148. -    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  21149. -  else
  21150. -    ac_dir_suffix= ac_dots=
  21151. -  fi
  21152. +  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
  21153. +else
  21154. +  ac_dir_suffix= ac_top_builddir=
  21155. +fi
  21156.  
  21157. -  case "$ac_given_srcdir" in
  21158. -  .)  srcdir=.
  21159. -      if test -z "$ac_dots"; then top_srcdir=.
  21160. -      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
  21161. -  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  21162. +case $srcdir in
  21163. +  .)  # No --srcdir option.  We are building in place.
  21164. +    ac_srcdir=.
  21165. +    if test -z "$ac_top_builddir"; then
  21166. +       ac_top_srcdir=.
  21167. +    else
  21168. +       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
  21169. +    fi ;;
  21170. +  [\\/]* | ?:[\\/]* )  # Absolute path.
  21171. +    ac_srcdir=$srcdir$ac_dir_suffix;
  21172. +    ac_top_srcdir=$srcdir ;;
  21173.    *) # Relative path.
  21174. -    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
  21175. -    top_srcdir="$ac_dots$ac_given_srcdir" ;;
  21176. -  esac
  21177. +    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
  21178. +    ac_top_srcdir=$ac_top_builddir$srcdir ;;
  21179. +esac
  21180. +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
  21181. +# absolute.
  21182. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
  21183. +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
  21184. +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
  21185. +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
  21186. +
  21187. +
  21188. +  case $INSTALL in
  21189. +  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
  21190. +  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
  21191. +  esac
  21192. +
  21193. +  if test x"$ac_file" != x-; then
  21194. +    { echo "$as_me:$LINENO: creating $ac_file" >&5
  21195. +echo "$as_me: creating $ac_file" >&6;}
  21196. +    rm -f "$ac_file"
  21197. +  fi
  21198. +  # Let's still pretend it is `configure' which instantiates (i.e., don't
  21199. +  # use $as_me), people would be surprised to read:
  21200. +  #    /* config.h.  Generated by config.status.  */
  21201. +  if test x"$ac_file" = x-; then
  21202. +    configure_input=
  21203. +  else
  21204. +    configure_input="$ac_file.  "
  21205. +  fi
  21206. +  configure_input=$configure_input"Generated from `echo $ac_file_in |
  21207. +                                     sed 's,.*/,,'` by configure."
  21208. +
  21209. +  # First look for the input files in the build tree, otherwise in the
  21210. +  # src tree.
  21211. +  ac_file_inputs=`IFS=:
  21212. +    for f in $ac_file_in; do
  21213. +      case $f in
  21214. +      -) echo $tmp/stdin ;;
  21215. +      [\\/$]*)
  21216. +         # Absolute (can't be DOS-style, as IFS=:)
  21217. +         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
  21218. +echo "$as_me: error: cannot find input file: $f" >&2;}
  21219. +   { (exit 1); exit 1; }; }
  21220. +         echo $f;;
  21221. +      *) # Relative
  21222. +         if test -f "$f"; then
  21223. +           # Build tree
  21224. +           echo $f
  21225. +         elif test -f "$srcdir/$f"; then
  21226. +           # Source tree
  21227. +           echo $srcdir/$f
  21228. +         else
  21229. +           # /dev/null tree
  21230. +           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
  21231. +echo "$as_me: error: cannot find input file: $f" >&2;}
  21232. +   { (exit 1); exit 1; }; }
  21233. +         fi;;
  21234. +      esac
  21235. +    done` || { (exit 1); exit 1; }
  21236. +_ACEOF
  21237. +cat >>$CONFIG_STATUS <<_ACEOF
  21238. +  sed "$ac_vpsub
  21239. +$extrasub
  21240. +_ACEOF
  21241. +cat >>$CONFIG_STATUS <<\_ACEOF
  21242. +:t
  21243. +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
  21244. +s,@configure_input@,$configure_input,;t t
  21245. +s,@srcdir@,$ac_srcdir,;t t
  21246. +s,@abs_srcdir@,$ac_abs_srcdir,;t t
  21247. +s,@top_srcdir@,$ac_top_srcdir,;t t
  21248. +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
  21249. +s,@builddir@,$ac_builddir,;t t
  21250. +s,@abs_builddir@,$ac_abs_builddir,;t t
  21251. +s,@top_builddir@,$ac_top_builddir,;t t
  21252. +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
  21253. +s,@INSTALL@,$ac_INSTALL,;t t
  21254. +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
  21255. +  rm -f $tmp/stdin
  21256. +  if test x"$ac_file" != x-; then
  21257. +    mv $tmp/out $ac_file
  21258. +  else
  21259. +    cat $tmp/out
  21260. +    rm -f $tmp/out
  21261. +  fi
  21262.  
  21263. -  case "$ac_given_INSTALL" in
  21264. -  [/$]*) INSTALL="$ac_given_INSTALL" ;;
  21265. -  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
  21266. -  esac
  21267. +done
  21268. +_ACEOF
  21269. +cat >>$CONFIG_STATUS <<\_ACEOF
  21270.  
  21271. -  echo creating "$ac_file"
  21272. -  rm -f "$ac_file"
  21273. -  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
  21274. -  case "$ac_file" in
  21275. -  *Makefile*) ac_comsub="1i\\
  21276. -# $configure_input" ;;
  21277. -  *) ac_comsub= ;;
  21278. -  esac
  21279. -
  21280. -  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
  21281. -  sed -e "$ac_comsub
  21282. -s%@configure_input@%$configure_input%g
  21283. -s%@srcdir@%$srcdir%g
  21284. -s%@top_srcdir@%$top_srcdir%g
  21285. -s%@INSTALL@%$INSTALL%g
  21286. -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
  21287. -fi; done
  21288. -rm -f conftest.s*
  21289. +#
  21290. +# CONFIG_HEADER section.
  21291. +#
  21292.  
  21293.  # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
  21294.  # NAME is the cpp macro being defined and VALUE is the value it is being given.
  21295.  #
  21296.  # ac_d sets the value in "#define NAME VALUE" lines.
  21297. -ac_dA='s%^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  21298. -ac_dB='\([     ][     ]*\)[^     ]*%\1#\2'
  21299. -ac_dC='\3'
  21300. -ac_dD='%g'
  21301. -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  21302. -ac_uA='s%^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  21303. -ac_uB='\([     ]\)%\1#\2define\3'
  21304. +ac_dA='s,^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  21305. +ac_dB='[     ].*$,\1#\2'
  21306. +ac_dC=' '
  21307. +ac_dD=',;t'
  21308. +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  21309. +ac_uA='s,^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  21310. +ac_uB='$,\1#\2define\3'
  21311.  ac_uC=' '
  21312. -ac_uD='\4%g'
  21313. -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  21314. -ac_eA='s%^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  21315. -ac_eB='$%\1#\2define\3'
  21316. -ac_eC=' '
  21317. -ac_eD='%g'
  21318. +ac_uD=',;t'
  21319.  
  21320. -if test "${CONFIG_HEADERS+set}" != set; then
  21321. -EOF
  21322. -cat >> $CONFIG_STATUS <<EOF
  21323. -  CONFIG_HEADERS="config.h:config.in"
  21324. -EOF
  21325. -cat >> $CONFIG_STATUS <<\EOF
  21326. -fi
  21327. -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
  21328. +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
  21329.    # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
  21330. -  case "$ac_file" in
  21331. -  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
  21332. -       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  21333. -  *) ac_file_in="${ac_file}.in" ;;
  21334. -  esac
  21335. -
  21336. -  echo creating $ac_file
  21337. -
  21338. -  rm -f conftest.frag conftest.in conftest.out
  21339. -  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
  21340. -  cat $ac_file_inputs > conftest.in
  21341. -
  21342. -EOF
  21343. -
  21344. -# Transform confdefs.h into a sed script conftest.vals that substitutes
  21345. -# the proper values into config.h.in to produce config.h.  And first:
  21346. -# Protect against being on the right side of a sed subst in config.status.
  21347. -# Protect against being in an unquoted here document in config.status.
  21348. -rm -f conftest.vals
  21349. -cat > conftest.hdr <<\EOF
  21350. -s/[\\&%]/\\&/g
  21351. -s%[\\$`]%\\&%g
  21352. -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
  21353. -s%ac_d%ac_u%gp
  21354. -s%ac_u%ac_e%gp
  21355. -EOF
  21356. -sed -n -f conftest.hdr confdefs.h > conftest.vals
  21357. -rm -f conftest.hdr
  21358. +  case $ac_file in
  21359. +  - | *:- | *:-:* ) # input from stdin
  21360. +        cat >$tmp/stdin
  21361. +        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
  21362. +        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  21363. +  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
  21364. +        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  21365. +  * )   ac_file_in=$ac_file.in ;;
  21366. +  esac
  21367. +
  21368. +  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
  21369. +echo "$as_me: creating $ac_file" >&6;}
  21370. +
  21371. +  # First look for the input files in the build tree, otherwise in the
  21372. +  # src tree.
  21373. +  ac_file_inputs=`IFS=:
  21374. +    for f in $ac_file_in; do
  21375. +      case $f in
  21376. +      -) echo $tmp/stdin ;;
  21377. +      [\\/$]*)
  21378. +         # Absolute (can't be DOS-style, as IFS=:)
  21379. +         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
  21380. +echo "$as_me: error: cannot find input file: $f" >&2;}
  21381. +   { (exit 1); exit 1; }; }
  21382. +         echo $f;;
  21383. +      *) # Relative
  21384. +         if test -f "$f"; then
  21385. +           # Build tree
  21386. +           echo $f
  21387. +         elif test -f "$srcdir/$f"; then
  21388. +           # Source tree
  21389. +           echo $srcdir/$f
  21390. +         else
  21391. +           # /dev/null tree
  21392. +           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
  21393. +echo "$as_me: error: cannot find input file: $f" >&2;}
  21394. +   { (exit 1); exit 1; }; }
  21395. +         fi;;
  21396. +      esac
  21397. +    done` || { (exit 1); exit 1; }
  21398. +  # Remove the trailing spaces.
  21399. +  sed 's/[     ]*$//' $ac_file_inputs >$tmp/in
  21400. +
  21401. +_ACEOF
  21402. +
  21403. +# Transform confdefs.h into two sed scripts, `conftest.defines' and
  21404. +# `conftest.undefs', that substitutes the proper values into
  21405. +# config.h.in to produce config.h.  The first handles `#define'
  21406. +# templates, and the second `#undef' templates.
  21407. +# And first: Protect against being on the right side of a sed subst in
  21408. +# config.status.  Protect against being in an unquoted here document
  21409. +# in config.status.
  21410. +rm -f conftest.defines conftest.undefs
  21411. +# Using a here document instead of a string reduces the quoting nightmare.
  21412. +# Putting comments in sed scripts is not portable.
  21413. +#
  21414. +# `end' is used to avoid that the second main sed command (meant for
  21415. +# 0-ary CPP macros) applies to n-ary macro definitions.
  21416. +# See the Autoconf documentation for `clear'.
  21417. +cat >confdef2sed.sed <<\_ACEOF
  21418. +s/[\\&,]/\\&/g
  21419. +s,[\\$`],\\&,g
  21420. +t clear
  21421. +: clear
  21422. +s,^[     ]*#[     ]*define[     ][     ]*\([^     (][^     (]*\)\(([^)]*)\)[     ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
  21423. +t end
  21424. +s,^[     ]*#[     ]*define[     ][     ]*\([^     ][^     ]*\)[     ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
  21425. +: end
  21426. +_ACEOF
  21427. +# If some macros were called several times there might be several times
  21428. +# the same #defines, which is useless.  Nevertheless, we may not want to
  21429. +# sort them, since we want the *last* AC-DEFINE to be honored.
  21430. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
  21431. +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
  21432. +rm -f confdef2sed.sed
  21433.  
  21434.  # This sed command replaces #undef with comments.  This is necessary, for
  21435.  # example, in the case of _POSIX_SOURCE, which is predefined and required
  21436.  # on some systems where configure will not decide to define it.
  21437. -cat >> conftest.vals <<\EOF
  21438. -s%^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
  21439. -EOF
  21440. -
  21441. -# Break up conftest.vals because some shells have a limit on
  21442. -# the size of here documents, and old seds have small limits too.
  21443. -
  21444. +cat >>conftest.undefs <<\_ACEOF
  21445. +s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  21446. +_ACEOF
  21447. +
  21448. +# Break up conftest.defines because some shells have a limit on the size
  21449. +# of here documents, and old seds have small limits too (100 cmds).
  21450. +echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
  21451. +echo '  if grep "^[     ]*#[     ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
  21452. +echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
  21453. +echo '  :' >>$CONFIG_STATUS
  21454.  rm -f conftest.tail
  21455. -while :
  21456. +while grep . conftest.defines >/dev/null
  21457.  do
  21458. -  ac_lines=`grep -c . conftest.vals`
  21459. -  # grep -c gives empty output for an empty file on some AIX systems.
  21460. -  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
  21461. -  # Write a limited-size here document to conftest.frag.
  21462. -  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
  21463. -  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
  21464. +  # Write a limited-size here document to $tmp/defines.sed.
  21465. +  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
  21466. +  # Speed up: don't consider the non `#define' lines.
  21467. +  echo '/^[     ]*#[     ]*define/!b' >>$CONFIG_STATUS
  21468. +  # Work around the forget-to-reset-the-flag bug.
  21469. +  echo 't clr' >>$CONFIG_STATUS
  21470. +  echo ': clr' >>$CONFIG_STATUS
  21471. +  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
  21472.    echo 'CEOF
  21473. -  sed -f conftest.frag conftest.in > conftest.out
  21474. -  rm -f conftest.in
  21475. -  mv conftest.out conftest.in
  21476. -' >> $CONFIG_STATUS
  21477. -  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
  21478. -  rm -f conftest.vals
  21479. -  mv conftest.tail conftest.vals
  21480. -done
  21481. -rm -f conftest.vals
  21482. -
  21483. -cat >> $CONFIG_STATUS <<\EOF
  21484. -  rm -f conftest.frag conftest.h
  21485. -  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
  21486. -  cat conftest.in >> conftest.h
  21487. -  rm -f conftest.in
  21488. -  if cmp -s $ac_file conftest.h 2>/dev/null; then
  21489. -    echo "$ac_file is unchanged"
  21490. -    rm -f conftest.h
  21491. -  else
  21492. -    # Remove last slash and all that follows it.  Not all systems have dirname.
  21493. -      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  21494. -      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
  21495. -      # The file is in a subdirectory.
  21496. -      test ! -d "$ac_dir" && mkdir "$ac_dir"
  21497. -    fi
  21498. +  sed -f $tmp/defines.sed $tmp/in >$tmp/out
  21499. +  rm -f $tmp/in
  21500. +  mv $tmp/out $tmp/in
  21501. +' >>$CONFIG_STATUS
  21502. +  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
  21503. +  rm -f conftest.defines
  21504. +  mv conftest.tail conftest.defines
  21505. +done
  21506. +rm -f conftest.defines
  21507. +echo '  fi # grep' >>$CONFIG_STATUS
  21508. +echo >>$CONFIG_STATUS
  21509. +
  21510. +# Break up conftest.undefs because some shells have a limit on the size
  21511. +# of here documents, and old seds have small limits too (100 cmds).
  21512. +echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
  21513. +rm -f conftest.tail
  21514. +while grep . conftest.undefs >/dev/null
  21515. +do
  21516. +  # Write a limited-size here document to $tmp/undefs.sed.
  21517. +  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
  21518. +  # Speed up: don't consider the non `#undef'
  21519. +  echo '/^[     ]*#[     ]*undef/!b' >>$CONFIG_STATUS
  21520. +  # Work around the forget-to-reset-the-flag bug.
  21521. +  echo 't clr' >>$CONFIG_STATUS
  21522. +  echo ': clr' >>$CONFIG_STATUS
  21523. +  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
  21524. +  echo 'CEOF
  21525. +  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
  21526. +  rm -f $tmp/in
  21527. +  mv $tmp/out $tmp/in
  21528. +' >>$CONFIG_STATUS
  21529. +  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
  21530. +  rm -f conftest.undefs
  21531. +  mv conftest.tail conftest.undefs
  21532. +done
  21533. +rm -f conftest.undefs
  21534. +
  21535. +cat >>$CONFIG_STATUS <<\_ACEOF
  21536. +  # Let's still pretend it is `configure' which instantiates (i.e., don't
  21537. +  # use $as_me), people would be surprised to read:
  21538. +  #    /* config.h.  Generated by config.status.  */
  21539. +  if test x"$ac_file" = x-; then
  21540. +    echo "/* Generated by configure.  */" >$tmp/config.h
  21541. +  else
  21542. +    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
  21543. +  fi
  21544. +  cat $tmp/in >>$tmp/config.h
  21545. +  rm -f $tmp/in
  21546. +  if test x"$ac_file" != x-; then
  21547. +    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
  21548. +      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
  21549. +echo "$as_me: $ac_file is unchanged" >&6;}
  21550. +    else
  21551. +      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
  21552. +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21553. +         X"$ac_file" : 'X\(//\)[^/]' \| \
  21554. +         X"$ac_file" : 'X\(//\)$' \| \
  21555. +         X"$ac_file" : 'X\(/\)' \| \
  21556. +         .     : '\(.\)' 2>/dev/null ||
  21557. +echo X"$ac_file" |
  21558. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21559. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21560. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21561. +        /^X\(\/\).*/{ s//\1/; q; }
  21562. +        s/.*/./; q'`
  21563. +      { if $as_mkdir_p; then
  21564. +    mkdir -p "$ac_dir"
  21565. +  else
  21566. +    as_dir="$ac_dir"
  21567. +    as_dirs=
  21568. +    while test ! -d "$as_dir"; do
  21569. +      as_dirs="$as_dir $as_dirs"
  21570. +      as_dir=`(dirname "$as_dir") 2>/dev/null ||
  21571. +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21572. +         X"$as_dir" : 'X\(//\)[^/]' \| \
  21573. +         X"$as_dir" : 'X\(//\)$' \| \
  21574. +         X"$as_dir" : 'X\(/\)' \| \
  21575. +         .     : '\(.\)' 2>/dev/null ||
  21576. +echo X"$as_dir" |
  21577. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21578. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21579. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21580. +        /^X\(\/\).*/{ s//\1/; q; }
  21581. +        s/.*/./; q'`
  21582. +    done
  21583. +    test ! -n "$as_dirs" || mkdir $as_dirs
  21584. +  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
  21585. +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
  21586. +   { (exit 1); exit 1; }; }; }
  21587. +
  21588.      rm -f $ac_file
  21589. -    mv conftest.h $ac_file
  21590. +      mv $tmp/config.h $ac_file
  21591. +    fi
  21592. +  else
  21593. +    cat $tmp/config.h
  21594. +    rm -f $tmp/config.h
  21595.    fi
  21596. -fi; done
  21597. +  # Run the commands associated with the file.
  21598. +  case $ac_file in
  21599. +    config.h ) # update the timestamp
  21600. +echo 'timestamp for config.h:config.in' >"./stamp-h1"
  21601. + ;;
  21602. +  esac
  21603. +done
  21604. +_ACEOF
  21605. +cat >>$CONFIG_STATUS <<\_ACEOF
  21606.  
  21607. -EOF
  21608. -cat >> $CONFIG_STATUS <<EOF
  21609. +#
  21610. +# CONFIG_COMMANDS section.
  21611. +#
  21612. +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
  21613. +  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
  21614. +  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
  21615. +  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
  21616. +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21617. +         X"$ac_dest" : 'X\(//\)[^/]' \| \
  21618. +         X"$ac_dest" : 'X\(//\)$' \| \
  21619. +         X"$ac_dest" : 'X\(/\)' \| \
  21620. +         .     : '\(.\)' 2>/dev/null ||
  21621. +echo X"$ac_dest" |
  21622. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21623. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21624. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21625. +        /^X\(\/\).*/{ s//\1/; q; }
  21626. +        s/.*/./; q'`
  21627. +  ac_builddir=.
  21628.  
  21629. +if test "$ac_dir" != .; then
  21630. +  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
  21631. +  # A "../" for each directory in $ac_dir_suffix.
  21632. +  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
  21633. +else
  21634. +  ac_dir_suffix= ac_top_builddir=
  21635. +fi
  21636.  
  21637. -EOF
  21638. -cat >> $CONFIG_STATUS <<\EOF
  21639. -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
  21640. -sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile
  21641. -exit 0
  21642. -EOF
  21643. +case $srcdir in
  21644. +  .)  # No --srcdir option.  We are building in place.
  21645. +    ac_srcdir=.
  21646. +    if test -z "$ac_top_builddir"; then
  21647. +       ac_top_srcdir=.
  21648. +    else
  21649. +       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
  21650. +    fi ;;
  21651. +  [\\/]* | ?:[\\/]* )  # Absolute path.
  21652. +    ac_srcdir=$srcdir$ac_dir_suffix;
  21653. +    ac_top_srcdir=$srcdir ;;
  21654. +  *) # Relative path.
  21655. +    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
  21656. +    ac_top_srcdir=$ac_top_builddir$srcdir ;;
  21657. +esac
  21658. +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
  21659. +# absolute.
  21660. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
  21661. +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
  21662. +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
  21663. +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
  21664. +
  21665. +
  21666. +  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
  21667. +echo "$as_me: executing $ac_dest commands" >&6;}
  21668. +  case $ac_dest in
  21669. +    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
  21670. +  # Strip MF so we end up with the name of the file.
  21671. +  mf=`echo "$mf" | sed -e 's/:.*$//'`
  21672. +  # Check whether this is an Automake generated Makefile or not.
  21673. +  # We used to match only the files named `Makefile.in', but
  21674. +  # some people rename them; so instead we look at the file content.
  21675. +  # Grep'ing the first line is not enough: some people post-process
  21676. +  # each Makefile.in and add a new line on top of each file to say so.
  21677. +  # So let's grep whole file.
  21678. +  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
  21679. +    dirpart=`(dirname "$mf") 2>/dev/null ||
  21680. +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21681. +         X"$mf" : 'X\(//\)[^/]' \| \
  21682. +         X"$mf" : 'X\(//\)$' \| \
  21683. +         X"$mf" : 'X\(/\)' \| \
  21684. +         .     : '\(.\)' 2>/dev/null ||
  21685. +echo X"$mf" |
  21686. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21687. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21688. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21689. +        /^X\(\/\).*/{ s//\1/; q; }
  21690. +        s/.*/./; q'`
  21691. +  else
  21692. +    continue
  21693. +  fi
  21694. +  grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
  21695. +  # Extract the definition of DEP_FILES from the Makefile without
  21696. +  # running `make'.
  21697. +  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
  21698. +  test -z "$DEPDIR" && continue
  21699. +  # When using ansi2knr, U may be empty or an underscore; expand it
  21700. +  U=`sed -n -e '/^U = / s///p' < "$mf"`
  21701. +  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
  21702. +  # We invoke sed twice because it is the simplest approach to
  21703. +  # changing $(DEPDIR) to its actual value in the expansion.
  21704. +  for file in `sed -n -e '
  21705. +    /^DEP_FILES = .*\\\\$/ {
  21706. +      s/^DEP_FILES = //
  21707. +      :loop
  21708. +    s/\\\\$//
  21709. +    p
  21710. +    n
  21711. +    /\\\\$/ b loop
  21712. +      p
  21713. +    }
  21714. +    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
  21715. +       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
  21716. +    # Make sure the directory exists.
  21717. +    test -f "$dirpart/$file" && continue
  21718. +    fdir=`(dirname "$file") 2>/dev/null ||
  21719. +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21720. +         X"$file" : 'X\(//\)[^/]' \| \
  21721. +         X"$file" : 'X\(//\)$' \| \
  21722. +         X"$file" : 'X\(/\)' \| \
  21723. +         .     : '\(.\)' 2>/dev/null ||
  21724. +echo X"$file" |
  21725. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21726. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21727. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21728. +        /^X\(\/\).*/{ s//\1/; q; }
  21729. +        s/.*/./; q'`
  21730. +    { if $as_mkdir_p; then
  21731. +    mkdir -p $dirpart/$fdir
  21732. +  else
  21733. +    as_dir=$dirpart/$fdir
  21734. +    as_dirs=
  21735. +    while test ! -d "$as_dir"; do
  21736. +      as_dirs="$as_dir $as_dirs"
  21737. +      as_dir=`(dirname "$as_dir") 2>/dev/null ||
  21738. +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  21739. +         X"$as_dir" : 'X\(//\)[^/]' \| \
  21740. +         X"$as_dir" : 'X\(//\)$' \| \
  21741. +         X"$as_dir" : 'X\(/\)' \| \
  21742. +         .     : '\(.\)' 2>/dev/null ||
  21743. +echo X"$as_dir" |
  21744. +    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  21745. +        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  21746. +        /^X\(\/\/\)$/{ s//\1/; q; }
  21747. +        /^X\(\/\).*/{ s//\1/; q; }
  21748. +        s/.*/./; q'`
  21749. +    done
  21750. +    test ! -n "$as_dirs" || mkdir $as_dirs
  21751. +  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
  21752. +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
  21753. +   { (exit 1); exit 1; }; }; }
  21754. +
  21755. +    # echo "creating $dirpart/$file"
  21756. +    echo '# dummy' > "$dirpart/$file"
  21757. +  done
  21758. +done
  21759. + ;;
  21760. +    default ) sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile ;;
  21761. +  esac
  21762. +done
  21763. +_ACEOF
  21764. +
  21765. +cat >>$CONFIG_STATUS <<\_ACEOF
  21766. +
  21767. +{ (exit 0); exit 0; }
  21768. +_ACEOF
  21769.  chmod +x $CONFIG_STATUS
  21770. -rm -fr confdefs* $ac_clean_files
  21771. -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
  21772. +ac_clean_files=$ac_clean_files_save
  21773. +
  21774. +
  21775. +# configure is writing to config.log, and then calls config.status.
  21776. +# config.status does its own redirection, appending to config.log.
  21777. +# Unfortunately, on DOS this fails, as config.log is still kept open
  21778. +# by configure, so config.status won't be able to write to it; its
  21779. +# output is simply discarded.  So we exec the FD to /dev/null,
  21780. +# effectively closing config.log, so it can be properly (re)opened and
  21781. +# appended to by config.status.  When coming back to configure, we
  21782. +# need to make the FD available again.
  21783. +if test "$no_create" != yes; then
  21784. +  ac_cs_success=:
  21785. +  ac_config_status_args=
  21786. +  test "$silent" = yes &&
  21787. +    ac_config_status_args="$ac_config_status_args --quiet"
  21788. +  exec 5>/dev/null
  21789. +  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
  21790. +  exec 5>>config.log
  21791. +  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
  21792. +  # would make configure fail if this is the last instruction.
  21793. +  $ac_cs_success || { (exit 1); exit 1; }
  21794. +fi
  21795.  
  21796.  
  21797. diff -urNEBb binutils-2.14-orig/bfd/configure.host binutils-2.14/bfd/configure.host
  21798. --- binutils-2.14-orig/bfd/configure.host    2002-12-17 05:17:20.000000000 +0100
  21799. +++ binutils-2.14/bfd/configure.host    2003-12-02 14:09:38.000000000 +0100
  21800. @@ -59,6 +59,7 @@
  21801.  mips*-*-riscos*)    HDEFINES="-G 4" ;;
  21802.  
  21803.  m68*-hp-hpux*)        HDEFINES=-DHOST_HP300HPUX ;;
  21804. +m68*-*-amigaos*)    HDEFINES=-mstackextend ;;
  21805.  
  21806.  *-*-aix*)        HOST_64BIT_TYPE="long long"
  21807.              HOST_U_64BIT_TYPE="unsigned long long"
  21808. diff -urNEBb binutils-2.14-orig/bfd/configure.in binutils-2.14/bfd/configure.in
  21809. --- binutils-2.14-orig/bfd/configure.in    2003-06-12 15:25:46.000000000 +0200
  21810. +++ binutils-2.14/bfd/configure.in    2003-12-15 12:05:14.000000000 +0100
  21811. @@ -18,7 +18,7 @@
  21812.  bfd_version_string="\"${VERSION}\""
  21813.  if test x${is_release} = x; then
  21814.    bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
  21815. -  bfd_version_string="\"${VERSION} ${bfd_version_date}\""
  21816. +  bfd_version_string="\"${VERSION} ${bfd_version_date} (Amiga, Inc. build 20031201)\""
  21817.  fi
  21818.  AC_SUBST(bfd_version)
  21819.  AC_SUBST(bfd_version_string)
  21820. @@ -544,8 +544,10 @@
  21821.      # use one entry per line, even though this leads to long lines.
  21822.      a29kcoff_big_vec)        tb="$tb coff-a29k.lo cofflink.lo" ;;
  21823.      a_out_adobe_vec)        tb="$tb aout-adobe.lo aout32.lo" ;;
  21824. +    amiga_vec)                  tb="$tb amigaos.lo amigaoslink.lo" ;;
  21825.      aix5coff64_vec)        tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
  21826.      aout0_big_vec)        tb="$tb aout0.lo aout32.lo" ;;
  21827. +    aout_amiga_vec)        tb="$tb aout-amiga.lo aout32.lo";;
  21828.      aout_arm_big_vec)        tb="$tb aout-arm.lo aout32.lo" ;;
  21829.      aout_arm_little_vec)    tb="$tb aout-arm.lo aout32.lo" ;;
  21830.      aout_mips_big_vec)        tb="$tb mipsbsd.lo aout32.lo" ;;
  21831. @@ -566,6 +568,7 @@
  21832.      b_out_vec_little_host)    tb="$tb bout.lo aout32.lo" ;;
  21833.      bfd_efi_app_ia32_vec)    tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
  21834.      bfd_efi_app_ia64_vec)    tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
  21835. +    bfd_elf32_amiga_vec)    tb="$tb elf32-amiga.lo elf32.lo $elf" ;;
  21836.      bfd_elf32_avr_vec)        tb="$tb elf32-avr.lo elf32.lo $elf" ;;
  21837.      bfd_elf32_big_generic_vec)     tb="$tb elf32-gen.lo elf32.lo $elf" ;;
  21838.      bfd_elf32_bigarc_vec)    tb="$tb elf32-arc.lo elf32.lo $elf" ;;
  21839. @@ -584,6 +587,7 @@
  21840.      bfd_elf32_i370_vec)        tb="$tb elf32-i370.lo elf32.lo $elf" ;;
  21841.      bfd_elf32_i386_freebsd_vec)    tb="$tb elf32-i386.lo elf32.lo $elf" ;;
  21842.      bfd_elf32_i386_vec)        tb="$tb elf32-i386.lo elf32.lo $elf" ;;
  21843. +    bfd_elf32_i386be_amithlon_vec) tb="$tb elf32-i386-amithlon.lo elf32.lo $elf" ;;
  21844.      bfd_elf32_i860_little_vec)    tb="$tb elf32-i860.lo elf32.lo $elf" ;;
  21845.      bfd_elf32_i860_vec)        tb="$tb elf32-i860.lo elf32.lo $elf" ;;
  21846.      bfd_elf32_i960_vec)        tb="$tb elf32-i960.lo elf32.lo $elf" ;;
  21847. @@ -605,6 +609,7 @@
  21848.      bfd_elf32_mcore_little_vec)    tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
  21849.      bfd_elf32_mn10200_vec)    tb="$tb elf-m10200.lo elf32.lo $elf" ;;
  21850.      bfd_elf32_mn10300_vec)    tb="$tb elf-m10300.lo elf32.lo $elf" ;;
  21851. +    bfd_elf32_morphos_vec)      tb="$tb elf32-morphos.lo elf32.lo $elf";;
  21852.      bfd_elf32_msp430_vec)    tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
  21853.      bfd_elf32_nbigmips_vec)    tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
  21854.      bfd_elf32_nlittlemips_vec)    tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
  21855. diff -urNEBb binutils-2.14-orig/bfd/doc/Makefile.am binutils-2.14/bfd/doc/Makefile.am
  21856. --- binutils-2.14-orig/bfd/doc/Makefile.am    2002-11-18 17:37:54.000000000 +0100
  21857. +++ binutils-2.14/bfd/doc/Makefile.am    2003-12-02 14:09:39.000000000 +0100
  21858. @@ -2,7 +2,7 @@
  21859.  
  21860.  AUTOMAKE_OPTIONS = cygnus
  21861.  
  21862. -DOCFILES = aoutx.texi  archive.texi archures.texi \
  21863. +DOCFILES = amiga.texi amigalink.texi aoutx.texi  archive.texi archures.texi \
  21864.      bfdt.texi  cache.texi coffcode.texi \
  21865.      core.texi elf.texi elfcode.texi  format.texi \
  21866.      libbfd.texi bfdwin.texi bfdio.texi \
  21867. @@ -28,6 +28,7 @@
  21868.      $(srcdir)/../cache.c $(srcdir)/../coffcode.h \
  21869.      $(srcdir)/../corefile.c $(srcdir)/../elf.c \
  21870.      $(srcdir)/../elfcode.h  $(srcdir)/../format.c \
  21871. +    $(srcdir)/../amigaos.c $(srcdir)/../amigaoslink.c \
  21872.      $(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
  21873.      $(srcdir)/../reloc.c  $(srcdir)/../section.c \
  21874.      $(srcdir)/../syms.c  $(srcdir)/../targets.c \
  21875. @@ -55,14 +56,15 @@
  21876.  MKDOC = chew$(EXEEXT_FOR_BUILD)
  21877.  
  21878.  $(MKDOC): chew.o
  21879. -    $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
  21880. +    $(CC_FOR_BUILD) $(H_CFLAGS) $(CFLAGS) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
  21881.  
  21882.  chew.o: chew.c
  21883.      $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
  21884.  
  21885.  protos: libbfd.h libcoff.h bfd.h
  21886.  
  21887. -bfd.info bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo
  21888. +bfd.info bfd.dvi bfd.guide: $(DOCFILES) bfdsumm.texi bfd.texinfo
  21889. +
  21890.  
  21891.  # We can't replace these rules with an implicit rule, because
  21892.  # makes without VPATH support couldn't find the .h files in `..'.
  21893. @@ -208,6 +210,18 @@
  21894.      touch s-linker
  21895.  linker.texi: s-linker
  21896.  
  21897. +s-amiga: $(MKDOC) $(srcdir)/../amigaos.c $(srcdir)/doc.str
  21898. +    ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaos.c >amiga.tmp
  21899. +    $(srcdir)/../../move-if-change amiga.tmp amiga.texi
  21900. +    touch s-amiga
  21901. +amiga.texi: s-amiga
  21902. +
  21903. +s-amigalink: $(MKDOC) $(srcdir)/../amigaoslink.c $(srcdir)/doc.str
  21904. +    ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaoslink.c >amigalink.tmp
  21905. +    $(srcdir)/../../move-if-change amigalink.tmp amigalink.texi
  21906. +    touch s-amigalink
  21907. +amigalink.texi: s-amigalink
  21908. +
  21909.  LIBBFD_H_DEP = \
  21910.      $(srcdir)/../libbfd-in.h    \
  21911.      $(srcdir)/../init.c        \
  21912. @@ -304,4 +318,4 @@
  21913.  
  21914.  # We want install to imply install-info as per GNU standards, despite the
  21915.  # cygnus option.
  21916. -install: install-info
  21917. +#install: install-info
  21918. diff -urNEBb binutils-2.14-orig/bfd/doc/Makefile.in binutils-2.14/bfd/doc/Makefile.in
  21919. --- binutils-2.14-orig/bfd/doc/Makefile.in    2002-11-18 17:37:54.000000000 +0100
  21920. +++ binutils-2.14/bfd/doc/Makefile.in    2003-12-02 14:09:39.000000000 +0100
  21921. @@ -1,6 +1,8 @@
  21922. -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
  21923. +# Makefile.in generated by automake 1.7.4 from Makefile.am.
  21924. +# @configure_input@
  21925.  
  21926. -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
  21927. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
  21928. +# Free Software Foundation, Inc.
  21929.  # This Makefile.in is free software; the Free Software Foundation
  21930.  # gives unlimited permission to copy and/or distribute it,
  21931.  # with or without modifications, as long as this notice is preserved.
  21932. @@ -10,30 +12,11 @@
  21933.  # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  21934.  # PARTICULAR PURPOSE.
  21935.  
  21936. -
  21937. -SHELL = @SHELL@
  21938. +@SET_MAKE@
  21939.  
  21940.  srcdir = @srcdir@
  21941.  top_srcdir = @top_srcdir@
  21942.  VPATH = @srcdir@
  21943. -prefix = @prefix@
  21944. -exec_prefix = @exec_prefix@
  21945. -
  21946. -bindir = @bindir@
  21947. -sbindir = @sbindir@
  21948. -libexecdir = @libexecdir@
  21949. -datadir = @datadir@
  21950. -sysconfdir = @sysconfdir@
  21951. -sharedstatedir = @sharedstatedir@
  21952. -localstatedir = @localstatedir@
  21953. -libdir = @libdir@
  21954. -infodir = @infodir@
  21955. -mandir = @mandir@
  21956. -includedir = @includedir@
  21957. -oldincludedir = /usr/include
  21958. -
  21959. -DESTDIR =
  21960. -
  21961.  pkgdatadir = $(datadir)/@PACKAGE@
  21962.  pkglibdir = $(libdir)/@PACKAGE@
  21963.  pkgincludedir = $(includedir)/@PACKAGE@
  21964. @@ -37,34 +20,34 @@
  21965.  pkgdatadir = $(datadir)/@PACKAGE@
  21966.  pkglibdir = $(libdir)/@PACKAGE@
  21967.  pkgincludedir = $(includedir)/@PACKAGE@
  21968. -
  21969.  top_builddir = ..
  21970.  
  21971. -ACLOCAL = @ACLOCAL@
  21972. -AUTOCONF = @AUTOCONF@
  21973. -AUTOMAKE = @AUTOMAKE@
  21974. -AUTOHEADER = @AUTOHEADER@
  21975. -
  21976. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
  21977.  INSTALL = @INSTALL@
  21978. -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
  21979. -INSTALL_DATA = @INSTALL_DATA@
  21980. -INSTALL_SCRIPT = @INSTALL_SCRIPT@
  21981. -transform = @program_transform_name@
  21982. -
  21983. +install_sh_DATA = $(install_sh) -c -m 644
  21984. +install_sh_PROGRAM = $(install_sh) -c
  21985. +install_sh_SCRIPT = $(install_sh) -c
  21986. +INSTALL_HEADER = $(INSTALL_DATA)
  21987. +transform = $(program_transform_name)
  21988.  NORMAL_INSTALL = :
  21989.  PRE_INSTALL = :
  21990.  POST_INSTALL = :
  21991.  NORMAL_UNINSTALL = :
  21992.  PRE_UNINSTALL = :
  21993.  POST_UNINSTALL = :
  21994. -build_alias = @build_alias@
  21995.  build_triplet = @build@
  21996. -host_alias = @host_alias@
  21997.  host_triplet = @host@
  21998. -target_alias = @target_alias@
  21999.  target_triplet = @target@
  22000. +ACLOCAL = @ACLOCAL@
  22001. +ALLOCA = @ALLOCA@
  22002. +AMDEP_FALSE = @AMDEP_FALSE@
  22003. +AMDEP_TRUE = @AMDEP_TRUE@
  22004. +AMTAR = @AMTAR@
  22005.  AR = @AR@
  22006. -AS = @AS@
  22007. +AUTOCONF = @AUTOCONF@
  22008. +AUTOHEADER = @AUTOHEADER@
  22009. +AUTOMAKE = @AUTOMAKE@
  22010. +AWK = @AWK@
  22011.  BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
  22012.  BFD_HOST_64_BIT = @BFD_HOST_64_BIT@
  22013.  BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@
  22014. @@ -72,39 +55,63 @@
  22015.  CATALOGS = @CATALOGS@
  22016.  CATOBJEXT = @CATOBJEXT@
  22017.  CC = @CC@
  22018. +CCDEPMODE = @CCDEPMODE@
  22019.  CC_FOR_BUILD = @CC_FOR_BUILD@
  22020. +CFLAGS = @CFLAGS@
  22021.  COREFILE = @COREFILE@
  22022.  COREFLAG = @COREFLAG@
  22023. -CXX = @CXX@
  22024. -CXXCPP = @CXXCPP@
  22025. +CPP = @CPP@
  22026. +CPPFLAGS = @CPPFLAGS@
  22027.  DATADIRNAME = @DATADIRNAME@
  22028. -DLLTOOL = @DLLTOOL@
  22029. +DEFS = @DEFS@
  22030. +DEPDIR = @DEPDIR@
  22031. +ECHO_C = @ECHO_C@
  22032. +ECHO_N = @ECHO_N@
  22033. +ECHO_T = @ECHO_T@
  22034. +EGREP = @EGREP@
  22035.  EXEEXT = @EXEEXT@
  22036.  EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
  22037. -GCJ = @GCJ@
  22038. -GCJFLAGS = @GCJFLAGS@
  22039.  GMOFILES = @GMOFILES@
  22040.  GMSGFMT = @GMSGFMT@
  22041.  GT_NO = @GT_NO@
  22042.  GT_YES = @GT_YES@
  22043.  HDEFINES = @HDEFINES@
  22044.  INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
  22045. +INSTALL_DATA = @INSTALL_DATA@
  22046. +INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@
  22047. +INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@
  22048. +INSTALL_PROGRAM = @INSTALL_PROGRAM@
  22049. +INSTALL_SCRIPT = @INSTALL_SCRIPT@
  22050. +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
  22051.  INSTOBJEXT = @INSTOBJEXT@
  22052.  INTLDEPS = @INTLDEPS@
  22053.  INTLLIBS = @INTLLIBS@
  22054.  INTLOBJS = @INTLOBJS@
  22055. +LDFLAGS = @LDFLAGS@
  22056. +LIBOBJS = @LIBOBJS@
  22057. +LIBS = @LIBS@
  22058.  LIBTOOL = @LIBTOOL@
  22059.  LN_S = @LN_S@
  22060. +LTLIBOBJS = @LTLIBOBJS@
  22061.  MAINT = @MAINT@
  22062. +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
  22063. +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
  22064.  MAKEINFO = @MAKEINFO@
  22065.  MKINSTALLDIRS = @MKINSTALLDIRS@
  22066.  MSGFMT = @MSGFMT@
  22067. -OBJDUMP = @OBJDUMP@
  22068.  OBJEXT = @OBJEXT@
  22069.  PACKAGE = @PACKAGE@
  22070. +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
  22071. +PACKAGE_NAME = @PACKAGE_NAME@
  22072. +PACKAGE_STRING = @PACKAGE_STRING@
  22073. +PACKAGE_TARNAME = @PACKAGE_TARNAME@
  22074. +PACKAGE_VERSION = @PACKAGE_VERSION@
  22075. +PATH_SEPARATOR = @PATH_SEPARATOR@
  22076.  POFILES = @POFILES@
  22077.  POSUB = @POSUB@
  22078.  RANLIB = @RANLIB@
  22079. +SET_MAKE = @SET_MAKE@
  22080. +SHELL = @SHELL@
  22081.  STRIP = @STRIP@
  22082.  TDEFINES = @TDEFINES@
  22083.  USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
  22084. @@ -113,7 +120,14 @@
  22085.  WARN_CFLAGS = @WARN_CFLAGS@
  22086.  WIN32LDFLAGS = @WIN32LDFLAGS@
  22087.  WIN32LIBADD = @WIN32LIBADD@
  22088. +XGETTEXT = @XGETTEXT@
  22089. +ac_ct_AR = @ac_ct_AR@
  22090. +ac_ct_CC = @ac_ct_CC@
  22091. +ac_ct_RANLIB = @ac_ct_RANLIB@
  22092. +ac_ct_STRIP = @ac_ct_STRIP@
  22093.  all_backends = @all_backends@
  22094. +am__include = @am__include@
  22095. +am__quote = @am__quote@
  22096.  bfd_backends = @bfd_backends@
  22097.  bfd_default_target_size = @bfd_default_target_size@
  22098.  bfd_libs = @bfd_libs@
  22099. @@ -122,13 +136,44 @@
  22100.  bfd_version_string = @bfd_version_string@
  22101.  bfdincludedir = @bfdincludedir@
  22102.  bfdlibdir = @bfdlibdir@
  22103. +bindir = @bindir@
  22104. +build = @build@
  22105. +build_alias = @build_alias@
  22106. +build_cpu = @build_cpu@
  22107. +build_os = @build_os@
  22108. +build_vendor = @build_vendor@
  22109. +datadir = @datadir@
  22110. +exec_prefix = @exec_prefix@
  22111. +host = @host@
  22112. +host_alias = @host_alias@
  22113. +host_cpu = @host_cpu@
  22114. +host_os = @host_os@
  22115. +host_vendor = @host_vendor@
  22116. +includedir = @includedir@
  22117. +infodir = @infodir@
  22118. +install_sh = @install_sh@
  22119.  l = @l@
  22120. +libdir = @libdir@
  22121. +libexecdir = @libexecdir@
  22122. +localstatedir = @localstatedir@
  22123. +mandir = @mandir@
  22124. +oldincludedir = @oldincludedir@
  22125. +prefix = @prefix@
  22126. +program_transform_name = @program_transform_name@
  22127. +sbindir = @sbindir@
  22128. +sharedstatedir = @sharedstatedir@
  22129. +sysconfdir = @sysconfdir@
  22130. +target = @target@
  22131. +target_alias = @target_alias@
  22132. +target_cpu = @target_cpu@
  22133. +target_os = @target_os@
  22134. +target_vendor = @target_vendor@
  22135.  tdefaults = @tdefaults@
  22136.  wordsize = @wordsize@
  22137.  
  22138.  AUTOMAKE_OPTIONS = cygnus
  22139.  
  22140. -DOCFILES = aoutx.texi  archive.texi archures.texi \
  22141. +DOCFILES = amiga.texi amigalink.texi aoutx.texi  archive.texi archures.texi \
  22142.      bfdt.texi  cache.texi coffcode.texi \
  22143.      core.texi elf.texi elfcode.texi  format.texi \
  22144.      libbfd.texi bfdwin.texi bfdio.texi \
  22145. @@ -156,6 +201,7 @@
  22146.      $(srcdir)/../cache.c $(srcdir)/../coffcode.h \
  22147.      $(srcdir)/../corefile.c $(srcdir)/../elf.c \
  22148.      $(srcdir)/../elfcode.h  $(srcdir)/../format.c \
  22149. +    $(srcdir)/../amigaos.c $(srcdir)/../amigaoslink.c \
  22150.      $(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
  22151.      $(srcdir)/../reloc.c  $(srcdir)/../section.c \
  22152.      $(srcdir)/../syms.c  $(srcdir)/../targets.c \
  22153. @@ -241,141 +287,114 @@
  22154.  DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log
  22155.  
  22156.  MAINTAINERCLEANFILES = $(DOCFILES)
  22157. +subdir = doc
  22158. +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
  22159.  mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
  22160. -CONFIG_HEADER = ../config.h
  22161. +CONFIG_HEADER = $(top_builddir)/config.h
  22162.  CONFIG_CLEAN_FILES = 
  22163. -TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi`
  22164. +depcomp =
  22165. +am__depfiles_maybe =
  22166. +DIST_SOURCES =
  22167.  TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
  22168. +am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo
  22169.  INFO_DEPS = bfd.info
  22170.  DVIS = bfd.dvi
  22171. +PDFS = bfd.pdf
  22172. +PSS = bfd.ps
  22173.  TEXINFOS = bfd.texinfo
  22174. -DIST_COMMON =  ChangeLog Makefile.am Makefile.in
  22175. -
  22176. -
  22177. -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
  22178. +all: all-am
  22179.  
  22180. -TAR = gtar
  22181. -GZIP_ENV = --best
  22182. -all: all-redirect
  22183.  .SUFFIXES:
  22184. -.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
  22185. +.SUFFIXES: .dvi .info .pdf .ps .texinfo
  22186.  $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
  22187. -    cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile
  22188. -
  22189. -Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
  22190. -    cd $(top_builddir) \
  22191. -      && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
  22192. -
  22193. +    cd $(top_srcdir) && \
  22194. +      $(AUTOMAKE) --cygnus  doc/Makefile
  22195. +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in  $(top_builddir)/config.status
  22196. +    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
  22197.  
  22198. -bfd.info: bfd.texinfo
  22199. -bfd.dvi: bfd.texinfo
  22200. +mostlyclean-libtool:
  22201. +    -rm -f *.lo
  22202.  
  22203. +clean-libtool:
  22204. +    -rm -rf .libs _libs
  22205.  
  22206. -DVIPS = dvips
  22207. -
  22208. -.texi.info:
  22209. -    @rm -f $@ $@-[0-9] $@-[0-9][0-9]
  22210. -    $(MAKEINFO) -I $(srcdir) $<
  22211. -
  22212. -.texi.dvi:
  22213. -    TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
  22214. -      MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
  22215. -
  22216. -.texi:
  22217. -    @rm -f $@ $@-[0-9] $@-[0-9][0-9]
  22218. -    $(MAKEINFO) -I $(srcdir) $<
  22219. +distclean-libtool:
  22220. +    -rm -f libtool
  22221.  
  22222.  .texinfo.info:
  22223. -    @rm -f $@ $@-[0-9] $@-[0-9][0-9]
  22224. -    $(MAKEINFO) -I $(srcdir) $<
  22225. -
  22226. -.texinfo:
  22227. -    @rm -f $@ $@-[0-9] $@-[0-9][0-9]
  22228. -    $(MAKEINFO) -I $(srcdir) $<
  22229. +    @rm -f $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]
  22230. +    $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
  22231. +     -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
  22232.  
  22233.  .texinfo.dvi:
  22234. -    TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
  22235. -      MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
  22236. +    TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
  22237. +    MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
  22238. +    $(TEXI2DVI) `test -f '$<' || echo '$(srcdir)/'`$<
  22239. +
  22240. +.texinfo.pdf:
  22241. +    TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
  22242. +    MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
  22243. +    $(TEXI2PDF) `test -f '$<' || echo '$(srcdir)/'`$<
  22244. +bfd.info: bfd.texinfo 
  22245. +bfd.dvi: bfd.texinfo 
  22246. +bfd.pdf: bfd.texinfo 
  22247.  
  22248. -.txi.info:
  22249. -    @rm -f $@ $@-[0-9] $@-[0-9][0-9]
  22250. -    $(MAKEINFO) -I $(srcdir) $<
  22251. -
  22252. -.txi.dvi:
  22253. -    TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
  22254. -      MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
  22255. -
  22256. -.txi:
  22257. -    @rm -f $@ $@-[0-9] $@-[0-9][0-9]
  22258. -    $(MAKEINFO) -I $(srcdir) $<
  22259. -.dvi.ps:
  22260. -    $(DVIPS) $< -o $@
  22261. +TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then \
  22262. +             echo $(top_srcdir)/../texinfo/util/texi2dvi; \
  22263. +           else \
  22264. +             echo texi2dvi; \
  22265. +           fi`
  22266.  
  22267. -install-info-am: $(INFO_DEPS)
  22268. -    @$(NORMAL_INSTALL)
  22269. -    $(mkinstalldirs) $(DESTDIR)$(infodir)
  22270. -    @list='$(INFO_DEPS)'; \
  22271. -    for file in $$list; do \
  22272. -      if test -f $$file; then d=.; else d=$(srcdir); fi; \
  22273. -      for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
  22274. -        if test -f $$d/$$ifile; then \
  22275. -          echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
  22276. -          $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
  22277. -        else : ; fi; \
  22278. -      done; \
  22279. -    done
  22280. -    @$(POST_INSTALL)
  22281. -    @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
  22282. -      list='$(INFO_DEPS)'; \
  22283. -      for file in $$list; do \
  22284. -        echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
  22285. -        install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
  22286. -      done; \
  22287. -    else : ; fi
  22288. +TEXI2PDF = $(TEXI2DVI) --pdf --batch
  22289. +DVIPS = dvips
  22290. +.dvi.ps:
  22291. +    $(DVIPS) -o $@ $<
  22292.  
  22293. -uninstall-info:
  22294. +uninstall-info-am:
  22295.      $(PRE_UNINSTALL)
  22296. -    @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
  22297. -      ii=yes; \
  22298. -    else ii=; fi; \
  22299. +    @if (install-info --version && \
  22300. +         install-info --version | grep -i -v debian) >/dev/null 2>&1; then \
  22301.      list='$(INFO_DEPS)'; \
  22302.      for file in $$list; do \
  22303. -      test -z "$$ii" \
  22304. -        || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
  22305. -    done
  22306. +        relfile=`echo "$$file" | sed 's|^.*/||'`; \
  22307. +        echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$relfile"; \
  22308. +        install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$relfile; \
  22309. +      done; \
  22310. +    else :; fi
  22311.      @$(NORMAL_UNINSTALL)
  22312. -    list='$(INFO_DEPS)'; \
  22313. +    @list='$(INFO_DEPS)'; \
  22314.      for file in $$list; do \
  22315. -      (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
  22316. +      relfile=`echo "$$file" | sed 's|^.*/||'`; \
  22317. +      relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
  22318. +      (if cd $(DESTDIR)$(infodir); then \
  22319. +         echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \
  22320. +         rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
  22321. +       else :; fi); \
  22322.      done
  22323.  
  22324.  dist-info: $(INFO_DEPS)
  22325.      list='$(INFO_DEPS)'; \
  22326.      for base in $$list; do \
  22327.        if test -f $$base; then d=.; else d=$(srcdir); fi; \
  22328. -      for file in `cd $$d && eval echo $$base*`; do \
  22329. -        test -f $(distdir)/$$file \
  22330. -        || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
  22331. -        || cp -p $$d/$$file $(distdir)/$$file; \
  22332. +      for file in $$d/$$base*; do \
  22333. +        relfile=`expr "$$file" : "$$d/\(.*\)"`; \
  22334. +        test -f $(distdir)/$$relfile || \
  22335. +          cp -p $$file $(distdir)/$$relfile; \
  22336.        done; \
  22337.      done
  22338.  
  22339.  mostlyclean-aminfo:
  22340. -    -rm -f bfd.aux bfd.cp bfd.cps bfd.dvi bfd.fn bfd.fns bfd.ky bfd.kys \
  22341. -      bfd.ps bfd.log bfd.pg bfd.toc bfd.tp bfd.tps bfd.vr bfd.vrs \
  22342. -      bfd.op bfd.tr bfd.cv bfd.cn
  22343. -
  22344. -clean-aminfo:
  22345. -
  22346. -distclean-aminfo:
  22347. +    -rm -f bfd.aux bfd.cp bfd.cps bfd.fn bfd.ky bfd.kys bfd.log bfd.pg bfd.pgs \
  22348. +      bfd.tmp bfd.toc bfd.tp bfd.tps bfd.vr bfd.vrs bfd.dvi bfd.pdf \
  22349. +      bfd.ps
  22350.  
  22351.  maintainer-clean-aminfo:
  22352. -    for i in $(INFO_DEPS); do \
  22353. -      rm -f $$i; \
  22354. -      if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
  22355. -        rm -f $$i-[0-9]*; \
  22356. -      fi; \
  22357. +    @list='$(INFO_DEPS)'; for i in $$list; do \
  22358. +      i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
  22359. +      echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
  22360. +      rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
  22361.      done
  22362. +
  22363.  clean-info: mostlyclean-aminfo
  22364.  tags: TAGS
  22365.  TAGS:
  22366. @@ -380,51 +399,29 @@
  22367.  tags: TAGS
  22368.  TAGS:
  22369.  
  22370. +ctags: CTAGS
  22371. +CTAGS:
  22372.  
  22373. -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
  22374. -
  22375. -subdir = doc
  22376. -
  22377. -distdir: $(DISTFILES)
  22378. -    @for file in $(DISTFILES); do \
  22379. -      if test -f $$file; then d=.; else d=$(srcdir); fi; \
  22380. -      if test -d $$d/$$file; then \
  22381. -        cp -pr $$d/$$file $(distdir)/$$file; \
  22382. -      else \
  22383. -        test -f $(distdir)/$$file \
  22384. -        || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
  22385. -        || cp -p $$d/$$file $(distdir)/$$file || :; \
  22386. -      fi; \
  22387. -    done
  22388. -    $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
  22389. -info-am: $(INFO_DEPS)
  22390. -info: info-am
  22391. -dvi-am: $(DVIS)
  22392. -dvi: dvi-am
  22393.  check-am:
  22394.  check: check-am
  22395. -installcheck-am:
  22396. -installcheck: installcheck-am
  22397. -install-info-am: 
  22398. -install-info: install-info-am
  22399. -install-exec-am:
  22400. -install-exec: install-exec-am
  22401. +all-am: Makefile
  22402.  
  22403. -install-data-am:
  22404. -install-data: install-data-am
  22405. +installdirs:
  22406.  
  22407. -install-am: all-am
  22408. -    @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
  22409.  install: install-am
  22410. -uninstall-am:
  22411. +install-exec: install-exec-am
  22412. +install-data: install-data-am
  22413.  uninstall: uninstall-am
  22414. -all-am: Makefile
  22415. -all-redirect: all-am
  22416. -install-strip:
  22417. -    $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
  22418. -installdirs:
  22419.  
  22420. +install-am: all-am
  22421. +    @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
  22422.  
  22423. +installcheck: installcheck-am
  22424. +install-strip:
  22425. +    $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
  22426. +      INSTALL_STRIP_FLAG=-s \
  22427. +      `test -z '$(STRIP)' || \
  22428. +        echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
  22429.  mostlyclean-generic:
  22430.      -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
  22431.  
  22432. @@ -433,50 +430,104 @@
  22433.  
  22434.  distclean-generic:
  22435.      -rm -f Makefile $(CONFIG_CLEAN_FILES)
  22436. -    -rm -f config.cache config.log stamp-h stamp-h[0-9]*
  22437.      -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
  22438.  
  22439.  maintainer-clean-generic:
  22440. +    @echo "This command is intended for maintainers to use"
  22441. +    @echo "it deletes files that may require special tools to rebuild."
  22442.      -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
  22443. -mostlyclean-am:  mostlyclean-aminfo mostlyclean-generic
  22444. +clean: clean-am
  22445.  
  22446. -mostlyclean: mostlyclean-am
  22447. +clean-am: clean-generic clean-libtool mostlyclean-am
  22448.  
  22449. -clean-am:  clean-aminfo clean-generic mostlyclean-am
  22450. +distclean: distclean-am
  22451.  
  22452. -clean: clean-am
  22453. +distclean-am: clean-am distclean-generic distclean-libtool
  22454.  
  22455. -distclean-am:  distclean-aminfo distclean-generic clean-am
  22456. -    -rm -f libtool
  22457. +dvi: dvi-am
  22458.  
  22459. -distclean: distclean-am
  22460. +dvi-am: $(DVIS)
  22461.  
  22462. -maintainer-clean-am:  maintainer-clean-aminfo maintainer-clean-generic \
  22463. -        distclean-am
  22464. -    @echo "This command is intended for maintainers to use;"
  22465. -    @echo "it deletes files that may require special tools to rebuild."
  22466. +info: info-am
  22467. +
  22468. +info-am: $(INFO_DEPS)
  22469. +
  22470. +install-data-am:
  22471. +
  22472. +install-exec-am:
  22473. +
  22474. +install-info:
  22475. +
  22476. +install-info-am: $(INFO_DEPS)
  22477. +    @$(NORMAL_INSTALL)
  22478. +    $(mkinstalldirs) $(DESTDIR)$(infodir)
  22479. +    @list='$(INFO_DEPS)'; \
  22480. +    for file in $$list; do \
  22481. +      if test -f $$file; then d=.; else d=$(srcdir); fi; \
  22482. +      file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
  22483. +      for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
  22484. +                       $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
  22485. +        if test -f $$ifile; then \
  22486. +          relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
  22487. +          echo " $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile"; \
  22488. +          $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile; \
  22489. +        else : ; fi; \
  22490. +      done; \
  22491. +    done
  22492. +    @$(POST_INSTALL)
  22493. +    @if (install-info --version && \
  22494. +         install-info --version | grep -i -v debian) >/dev/null 2>&1; then \
  22495. +      list='$(INFO_DEPS)'; \
  22496. +      for file in $$list; do \
  22497. +        relfile=`echo "$$file" | sed 's|^.*/||'`; \
  22498. +        echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$relfile";\
  22499. +        install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$relfile || :;\
  22500. +      done; \
  22501. +    else : ; fi
  22502. +install-man:
  22503. +
  22504. +installcheck-am:
  22505.  
  22506.  maintainer-clean: maintainer-clean-am
  22507.  
  22508. -.PHONY: install-info-am uninstall-info mostlyclean-aminfo \
  22509. -distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir \
  22510. -info-am info dvi-am dvi check check-am installcheck-am installcheck \
  22511. -install-info-am install-info install-exec-am install-exec \
  22512. -install-data-am install-data install-am install uninstall-am uninstall \
  22513. -all-redirect all-am all installdirs mostlyclean-generic \
  22514. -distclean-generic clean-generic maintainer-clean-generic clean \
  22515. -mostlyclean distclean maintainer-clean
  22516. +maintainer-clean-am: distclean-am maintainer-clean-aminfo \
  22517. +    maintainer-clean-generic
  22518. +
  22519. +mostlyclean: mostlyclean-am
  22520. +
  22521. +mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
  22522. +    mostlyclean-libtool
  22523. +
  22524. +pdf: pdf-am
  22525. +
  22526. +pdf-am: $(PDFS)
  22527. +
  22528. +ps: ps-am
  22529. +
  22530. +ps-am: $(PSS)
  22531. +
  22532. +uninstall-am:
  22533. +
  22534. +.PHONY: all all-am check check-am clean clean-generic clean-info \
  22535. +    clean-libtool dist-info distclean distclean-generic \
  22536. +    distclean-libtool dvi dvi-am info info-am install install-am \
  22537. +    install-data install-data-am install-exec install-exec-am \
  22538. +    install-info install-info-am install-man install-strip \
  22539. +    installcheck installcheck-am installdirs maintainer-clean \
  22540. +    maintainer-clean-aminfo maintainer-clean-generic mostlyclean \
  22541. +    mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool pdf \
  22542. +    pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
  22543.  
  22544.  
  22545.  $(MKDOC): chew.o
  22546. -    $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
  22547. +    $(CC_FOR_BUILD) $(H_CFLAGS) $(CFLAGS) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
  22548.  
  22549.  chew.o: chew.c
  22550.      $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
  22551.  
  22552.  protos: libbfd.h libcoff.h bfd.h
  22553.  
  22554. -bfd.info bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo
  22555. +bfd.info bfd.dvi bfd.guide: $(DOCFILES) bfdsumm.texi bfd.texinfo
  22556.  
  22557.  # We can't replace these rules with an implicit rule, because
  22558.  # makes without VPATH support couldn't find the .h files in `..'.
  22559. @@ -622,6 +673,18 @@
  22560.      touch s-linker
  22561.  linker.texi: s-linker
  22562.  
  22563. +s-amiga: $(MKDOC) $(srcdir)/../amigaos.c $(srcdir)/doc.str
  22564. +    ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaos.c >amiga.tmp
  22565. +    $(srcdir)/../../move-if-change amiga.tmp amiga.texi
  22566. +    touch s-amiga
  22567. +amiga.texi: s-amiga
  22568. +
  22569. +s-amigalink: $(MKDOC) $(srcdir)/../amigaoslink.c $(srcdir)/doc.str
  22570. +    ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigaoslink.c >amigalink.tmp
  22571. +    $(srcdir)/../../move-if-change amigalink.tmp amigalink.texi
  22572. +    touch s-amigalink
  22573. +amigalink.texi: s-amigalink
  22574. +
  22575.  libbfd.h: $(LIBBFD_H_DEP)
  22576.      echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
  22577.      for file in $(LIBBFD_H_DEP); do \
  22578. @@ -664,8 +727,7 @@
  22579.  
  22580.  # We want install to imply install-info as per GNU standards, despite the
  22581.  # cygnus option.
  22582. -install: install-info
  22583. -
  22584. +#install: install-info
  22585.  # Tell versions [3.59,3.63) of GNU make to not export all variables.
  22586.  # Otherwise a system limit (for SysV at least) may be exceeded.
  22587.  .NOEXPORT:
  22588. diff -urNEBb binutils-2.14-orig/bfd/doc/bfd.texinfo binutils-2.14/bfd/doc/bfd.texinfo
  22589. --- binutils-2.14-orig/bfd/doc/bfd.texinfo    2003-02-13 12:26:40.000000000 +0100
  22590. +++ binutils-2.14/bfd/doc/bfd.texinfo    2003-12-02 14:09:39.000000000 +0100
  22591. @@ -299,6 +299,7 @@
  22592.  * aout ::    a.out backends
  22593.  * coff ::    coff backends
  22594.  * elf  ::    elf backends
  22595. +* amiga ::      amigaos backend
  22596.  * mmo  ::    mmo backend
  22597.  @ignore
  22598.  * oasys ::    oasys backends
  22599. @@ -315,12 +316,16 @@
  22600.  @node coff, elf, aout, BFD back ends
  22601.  @include  coffcode.texi
  22602.  
  22603. -@node elf, mmo, coff, BFD back ends
  22604. +@node elf, amiga, coff, BFD back ends
  22605.  @include  elf.texi
  22606.  @c Leave this out until the file has some actual contents...
  22607.  @c @include  elfcode.texi
  22608.  
  22609. -@node mmo,  , elf, BFD back ends
  22610. +@node amiga, mmo, elf, BFD back ends
  22611. +@include amiga.texi
  22612. +@include amigalink.texi
  22613. +
  22614. +@node mmo, , amiga, BFD back ends
  22615.  @include  mmo.texi
  22616.  
  22617.  @node GNU Free Documentation License, Index, BFD back ends, Top
  22618. diff -urNEBb binutils-2.14-orig/bfd/elf32-amiga.c binutils-2.14/bfd/elf32-amiga.c
  22619. --- binutils-2.14-orig/bfd/elf32-amiga.c    1970-01-01 01:00:00.000000000 +0100
  22620. +++ binutils-2.14/bfd/elf32-amiga.c    2003-12-02 14:09:38.000000000 +0100
  22621. @@ -0,0 +1,3844 @@
  22622. +/* PowerPC-specific support for 32-bit ELF
  22623. +   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
  22624. +   Free Software Foundation, Inc.
  22625. +   Written by Ian Lance Taylor, Cygnus Support.
  22626. +
  22627. +This file is part of BFD, the Binary File Descriptor library.
  22628. +
  22629. +This program is free software; you can redistribute it and/or modify
  22630. +it under the terms of the GNU General Public License as published by
  22631. +the Free Software Foundation; either version 2 of the License, or
  22632. +(at your option) any later version.
  22633. +
  22634. +This program is distributed in the hope that it will be useful,
  22635. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  22636. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22637. +GNU General Public License for more details.
  22638. +
  22639. +You should have received a copy of the GNU General Public License
  22640. +along with this program; if not, write to the Free Software
  22641. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  22642. +
  22643. +/* This file is based on a preliminary PowerPC ELF ABI.  The
  22644. +   information may not match the final PowerPC ELF ABI.  It includes
  22645. +   suggestions from the in-progress Embedded PowerPC ABI, and that
  22646. +   information may also not match.  */
  22647. +
  22648. +#include "bfd.h"
  22649. +#include "sysdep.h"
  22650. +#include "bfdlink.h"
  22651. +#include "libbfd.h"
  22652. +#include "elf-bfd.h"
  22653. +#include "elf/ppc.h"
  22654. +
  22655. +#define USE_RELA        /* we want RELA relocations, not REL */
  22656. +
  22657. +static reloc_howto_type *ppc_elf_reloc_type_lookup
  22658. +  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
  22659. +static void ppc_elf_info_to_howto
  22660. +  PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst));
  22661. +static void ppc_elf_howto_init PARAMS ((void));
  22662. +static int ppc_elf_sort_rela PARAMS ((const PTR, const PTR));
  22663. +static boolean ppc_elf_relax_section
  22664. +  PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
  22665. +static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
  22666. +  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
  22667. +static boolean ppc_elf_object_p PARAMS ((bfd *));
  22668. +static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword));
  22669. +static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
  22670. +
  22671. +static int ppc_elf_additional_program_headers PARAMS ((bfd *));
  22672. +static boolean ppc_elf_modify_segment_map PARAMS ((bfd *));
  22673. +
  22674. +static asection *ppc_elf_create_got
  22675. +  PARAMS ((bfd *, struct bfd_link_info *));
  22676. +static boolean ppc_elf_create_dynamic_sections
  22677. +  PARAMS ((bfd *, struct bfd_link_info *));
  22678. +
  22679. +static boolean ppc_elf_section_from_shdr PARAMS ((bfd *,
  22680. +                          Elf32_Internal_Shdr *,
  22681. +                          const char *));
  22682. +static boolean ppc_elf_fake_sections
  22683. +  PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
  22684. +
  22685. +static elf_linker_section_t *ppc_elf_create_linker_section
  22686. +  PARAMS ((bfd *abfd,
  22687. +       struct bfd_link_info *info,
  22688. +       enum elf_linker_section_enum));
  22689. +
  22690. +static boolean ppc_elf_check_relocs PARAMS ((bfd *,
  22691. +                         struct bfd_link_info *,
  22692. +                         asection *,
  22693. +                         const Elf_Internal_Rela *));
  22694. +
  22695. +static asection * ppc_elf_gc_mark_hook PARAMS ((asection *sec,
  22696. +                        struct bfd_link_info *info,
  22697. +                        Elf_Internal_Rela *rel,
  22698. +                        struct elf_link_hash_entry *h,
  22699. +                        Elf_Internal_Sym *sym));
  22700. +
  22701. +static boolean ppc_elf_gc_sweep_hook PARAMS ((bfd *abfd,
  22702. +                          struct bfd_link_info *info,
  22703. +                          asection *sec,
  22704. +                          const Elf_Internal_Rela *relocs));
  22705. +
  22706. +static boolean ppc_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *,
  22707. +                              struct elf_link_hash_entry *));
  22708. +
  22709. +static boolean ppc_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
  22710. +
  22711. +static boolean ppc_elf_relocate_section PARAMS ((bfd *,
  22712. +                         struct bfd_link_info *info,
  22713. +                         bfd *,
  22714. +                         asection *,
  22715. +                         bfd_byte *,
  22716. +                         Elf_Internal_Rela *relocs,
  22717. +                         Elf_Internal_Sym *local_syms,
  22718. +                         asection **));
  22719. +
  22720. +static boolean ppc_elf_add_symbol_hook  PARAMS ((bfd *,
  22721. +                         struct bfd_link_info *,
  22722. +                         const Elf_Internal_Sym *,
  22723. +                         const char **,
  22724. +                         flagword *,
  22725. +                         asection **,
  22726. +                         bfd_vma *));
  22727. +
  22728. +static boolean ppc_elf_finish_dynamic_symbol PARAMS ((bfd *,
  22729. +                              struct bfd_link_info *,
  22730. +                              struct elf_link_hash_entry *,
  22731. +                              Elf_Internal_Sym *));
  22732. +
  22733. +static boolean ppc_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
  22734. +static enum elf_reloc_type_class ppc_elf_reloc_type_class
  22735. +  PARAMS ((const Elf_Internal_Rela *));
  22736. +static boolean ppc_elf_grok_prstatus
  22737. +  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
  22738. +static boolean ppc_elf_grok_psinfo
  22739. +  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
  22740. +
  22741. +#define BRANCH_PREDICT_BIT 0x200000        /* branch prediction bit for branch taken relocs */
  22742. +#define RA_REGISTER_MASK 0x001f0000        /* mask to set RA in memory instructions */
  22743. +#define RA_REGISTER_SHIFT 16            /* value to shift register by to insert RA */
  22744. +
  22745. +/* The name of the dynamic interpreter.  This is put in the .interp
  22746. +   section.  */
  22747. +
  22748. +#define ELF_DYNAMIC_INTERPRETER "sys:libs/runtime-linker"
  22749. +
  22750. +/* The size in bytes of an entry in the procedure linkage table.  */
  22751. +#define PLT_ENTRY_SIZE 12
  22752. +/* The initial size of the plt reserved for the dynamic linker.  */
  22753. +#define PLT_INITIAL_ENTRY_SIZE 72
  22754. +/* The size of the gap between entries in the PLT.  */
  22755. +#define PLT_SLOT_SIZE 8
  22756. +/* The number of single-slot PLT entries (the rest use two slots).  */
  22757. +#define PLT_NUM_SINGLE_ENTRIES 8192
  22758. +
  22759. +/* Will references to this symbol always reference the symbol
  22760. +   in this object?  */
  22761. +#define SYMBOL_REFERENCES_LOCAL(INFO, H)                \
  22762. +  ((! INFO->shared                            \
  22763. +    || INFO->symbolic                            \
  22764. +    || H->dynindx == -1                            \
  22765. +    || ELF_ST_VISIBILITY (H->other) == STV_INTERNAL            \
  22766. +    || ELF_ST_VISIBILITY (H->other) == STV_HIDDEN)            \
  22767. +   && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
  22768. +
  22769. +/* Will _calls_ to this symbol always call the version in this object?  */
  22770. +#define SYMBOL_CALLS_LOCAL(INFO, H)                \
  22771. +  ((! INFO->shared                            \
  22772. +    || INFO->symbolic                            \
  22773. +    || H->dynindx == -1                            \
  22774. +    || ELF_ST_VISIBILITY (H->other) != STV_DEFAULT)            \
  22775. +   && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
  22776. +
  22777. +static reloc_howto_type *ppc_elf_howto_table[(int) R_PPC_max];
  22778. +
  22779. +static reloc_howto_type ppc_elf_howto_raw[] = {
  22780. +  /* This reloc does nothing.  */
  22781. +  HOWTO (R_PPC_NONE,        /* type */
  22782. +     0,            /* rightshift */
  22783. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22784. +     32,            /* bitsize */
  22785. +     false,            /* pc_relative */
  22786. +     0,            /* bitpos */
  22787. +     complain_overflow_bitfield, /* complain_on_overflow */
  22788. +     bfd_elf_generic_reloc,    /* special_function */
  22789. +     "R_PPC_NONE",        /* name */
  22790. +     false,            /* partial_inplace */
  22791. +     0,            /* src_mask */
  22792. +     0,            /* dst_mask */
  22793. +     false),        /* pcrel_offset */
  22794. +
  22795. +  /* A standard 32 bit relocation.  */
  22796. +  HOWTO (R_PPC_ADDR32,        /* type */
  22797. +     0,            /* rightshift */
  22798. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22799. +     32,            /* bitsize */
  22800. +     false,            /* pc_relative */
  22801. +     0,            /* bitpos */
  22802. +     complain_overflow_bitfield, /* complain_on_overflow */
  22803. +     bfd_elf_generic_reloc,    /* special_function */
  22804. +     "R_PPC_ADDR32",    /* name */
  22805. +     false,            /* partial_inplace */
  22806. +     0,            /* src_mask */
  22807. +     0xffffffff,        /* dst_mask */
  22808. +     false),        /* pcrel_offset */
  22809. +
  22810. +  /* An absolute 26 bit branch; the lower two bits must be zero.
  22811. +     FIXME: we don't check that, we just clear them.  */
  22812. +  HOWTO (R_PPC_ADDR24,        /* type */
  22813. +     0,            /* rightshift */
  22814. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22815. +     26,            /* bitsize */
  22816. +     false,            /* pc_relative */
  22817. +     0,            /* bitpos */
  22818. +     complain_overflow_bitfield, /* complain_on_overflow */
  22819. +     bfd_elf_generic_reloc,    /* special_function */
  22820. +     "R_PPC_ADDR24",    /* name */
  22821. +     false,            /* partial_inplace */
  22822. +     0,            /* src_mask */
  22823. +     0x3fffffc,        /* dst_mask */
  22824. +     false),        /* pcrel_offset */
  22825. +
  22826. +  /* A standard 16 bit relocation.  */
  22827. +  HOWTO (R_PPC_ADDR16,        /* type */
  22828. +     0,            /* rightshift */
  22829. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  22830. +     16,            /* bitsize */
  22831. +     false,            /* pc_relative */
  22832. +     0,            /* bitpos */
  22833. +     complain_overflow_bitfield, /* complain_on_overflow */
  22834. +     bfd_elf_generic_reloc,    /* special_function */
  22835. +     "R_PPC_ADDR16",    /* name */
  22836. +     false,            /* partial_inplace */
  22837. +     0,            /* src_mask */
  22838. +     0xffff,        /* dst_mask */
  22839. +     false),        /* pcrel_offset */
  22840. +
  22841. +  /* A 16 bit relocation without overflow.  */
  22842. +  HOWTO (R_PPC_ADDR16_LO,    /* type */
  22843. +     0,            /* rightshift */
  22844. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  22845. +     16,            /* bitsize */
  22846. +     false,            /* pc_relative */
  22847. +     0,            /* bitpos */
  22848. +     complain_overflow_dont,/* complain_on_overflow */
  22849. +     bfd_elf_generic_reloc,    /* special_function */
  22850. +     "R_PPC_ADDR16_LO",    /* name */
  22851. +     false,            /* partial_inplace */
  22852. +     0,            /* src_mask */
  22853. +     0xffff,        /* dst_mask */
  22854. +     false),        /* pcrel_offset */
  22855. +
  22856. +  /* The high order 16 bits of an address.  */
  22857. +  HOWTO (R_PPC_ADDR16_HI,    /* type */
  22858. +     16,            /* rightshift */
  22859. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  22860. +     16,            /* bitsize */
  22861. +     false,            /* pc_relative */
  22862. +     0,            /* bitpos */
  22863. +     complain_overflow_dont, /* complain_on_overflow */
  22864. +     bfd_elf_generic_reloc,    /* special_function */
  22865. +     "R_PPC_ADDR16_HI",    /* name */
  22866. +     false,            /* partial_inplace */
  22867. +     0,            /* src_mask */
  22868. +     0xffff,        /* dst_mask */
  22869. +     false),        /* pcrel_offset */
  22870. +
  22871. +  /* The high order 16 bits of an address, plus 1 if the contents of
  22872. +     the low 16 bits, treated as a signed number, is negative.  */
  22873. +  HOWTO (R_PPC_ADDR16_HA,    /* type */
  22874. +     16,            /* rightshift */
  22875. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  22876. +     16,            /* bitsize */
  22877. +     false,            /* pc_relative */
  22878. +     0,            /* bitpos */
  22879. +     complain_overflow_dont, /* complain_on_overflow */
  22880. +     ppc_elf_addr16_ha_reloc, /* special_function */
  22881. +     "R_PPC_ADDR16_HA",    /* name */
  22882. +     false,            /* partial_inplace */
  22883. +     0,            /* src_mask */
  22884. +     0xffff,        /* dst_mask */
  22885. +     false),        /* pcrel_offset */
  22886. +
  22887. +  /* An absolute 16 bit branch; the lower two bits must be zero.
  22888. +     FIXME: we don't check that, we just clear them.  */
  22889. +  HOWTO (R_PPC_ADDR14,        /* type */
  22890. +     0,            /* rightshift */
  22891. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22892. +     16,            /* bitsize */
  22893. +     false,            /* pc_relative */
  22894. +     0,            /* bitpos */
  22895. +     complain_overflow_bitfield, /* complain_on_overflow */
  22896. +     bfd_elf_generic_reloc,    /* special_function */
  22897. +     "R_PPC_ADDR14",    /* name */
  22898. +     false,            /* partial_inplace */
  22899. +     0,            /* src_mask */
  22900. +     0xfffc,        /* dst_mask */
  22901. +     false),        /* pcrel_offset */
  22902. +
  22903. +  /* An absolute 16 bit branch, for which bit 10 should be set to
  22904. +     indicate that the branch is expected to be taken.    The lower two
  22905. +     bits must be zero.  */
  22906. +  HOWTO (R_PPC_ADDR14_BRTAKEN,    /* type */
  22907. +     0,            /* rightshift */
  22908. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22909. +     16,            /* bitsize */
  22910. +     false,            /* pc_relative */
  22911. +     0,            /* bitpos */
  22912. +     complain_overflow_bitfield, /* complain_on_overflow */
  22913. +     bfd_elf_generic_reloc,    /* special_function */
  22914. +     "R_PPC_ADDR14_BRTAKEN",/* name */
  22915. +     false,            /* partial_inplace */
  22916. +     0,            /* src_mask */
  22917. +     0xfffc,        /* dst_mask */
  22918. +     false),        /* pcrel_offset */
  22919. +
  22920. +  /* An absolute 16 bit branch, for which bit 10 should be set to
  22921. +     indicate that the branch is not expected to be taken.  The lower
  22922. +     two bits must be zero.  */
  22923. +  HOWTO (R_PPC_ADDR14_BRNTAKEN, /* type */
  22924. +     0,            /* rightshift */
  22925. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22926. +     16,            /* bitsize */
  22927. +     false,            /* pc_relative */
  22928. +     0,            /* bitpos */
  22929. +     complain_overflow_bitfield, /* complain_on_overflow */
  22930. +     bfd_elf_generic_reloc,    /* special_function */
  22931. +     "R_PPC_ADDR14_BRNTAKEN",/* name */
  22932. +     false,            /* partial_inplace */
  22933. +     0,            /* src_mask */
  22934. +     0xfffc,        /* dst_mask */
  22935. +     false),        /* pcrel_offset */
  22936. +
  22937. +  /* A relative 26 bit branch; the lower two bits must be zero.  */
  22938. +  HOWTO (R_PPC_REL24,        /* type */
  22939. +     0,            /* rightshift */
  22940. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22941. +     26,            /* bitsize */
  22942. +     true,            /* pc_relative */
  22943. +     0,            /* bitpos */
  22944. +     complain_overflow_signed, /* complain_on_overflow */
  22945. +     bfd_elf_generic_reloc,    /* special_function */
  22946. +     "R_PPC_REL24",        /* name */
  22947. +     false,            /* partial_inplace */
  22948. +     0,            /* src_mask */
  22949. +     0x3fffffc,        /* dst_mask */
  22950. +     true),            /* pcrel_offset */
  22951. +
  22952. +  /* A relative 16 bit branch; the lower two bits must be zero.  */
  22953. +  HOWTO (R_PPC_REL14,        /* type */
  22954. +     0,            /* rightshift */
  22955. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22956. +     16,            /* bitsize */
  22957. +     true,            /* pc_relative */
  22958. +     0,            /* bitpos */
  22959. +     complain_overflow_signed, /* complain_on_overflow */
  22960. +     bfd_elf_generic_reloc,    /* special_function */
  22961. +     "R_PPC_REL14",        /* name */
  22962. +     false,            /* partial_inplace */
  22963. +     0,            /* src_mask */
  22964. +     0xfffc,        /* dst_mask */
  22965. +     true),            /* pcrel_offset */
  22966. +
  22967. +  /* A relative 16 bit branch.  Bit 10 should be set to indicate that
  22968. +     the branch is expected to be taken.  The lower two bits must be
  22969. +     zero.  */
  22970. +  HOWTO (R_PPC_REL14_BRTAKEN,    /* type */
  22971. +     0,            /* rightshift */
  22972. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22973. +     16,            /* bitsize */
  22974. +     true,            /* pc_relative */
  22975. +     0,            /* bitpos */
  22976. +     complain_overflow_signed, /* complain_on_overflow */
  22977. +     bfd_elf_generic_reloc,    /* special_function */
  22978. +     "R_PPC_REL14_BRTAKEN",    /* name */
  22979. +     false,            /* partial_inplace */
  22980. +     0,            /* src_mask */
  22981. +     0xfffc,        /* dst_mask */
  22982. +     true),            /* pcrel_offset */
  22983. +
  22984. +  /* A relative 16 bit branch.  Bit 10 should be set to indicate that
  22985. +     the branch is not expected to be taken.  The lower two bits must
  22986. +     be zero.  */
  22987. +  HOWTO (R_PPC_REL14_BRNTAKEN,    /* type */
  22988. +     0,            /* rightshift */
  22989. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  22990. +     16,            /* bitsize */
  22991. +     true,            /* pc_relative */
  22992. +     0,            /* bitpos */
  22993. +     complain_overflow_signed, /* complain_on_overflow */
  22994. +     bfd_elf_generic_reloc,    /* special_function */
  22995. +     "R_PPC_REL14_BRNTAKEN",/* name */
  22996. +     false,            /* partial_inplace */
  22997. +     0,            /* src_mask */
  22998. +     0xfffc,        /* dst_mask */
  22999. +     true),            /* pcrel_offset */
  23000. +
  23001. +  /* Like R_PPC_ADDR16, but referring to the GOT table entry for the
  23002. +     symbol.  */
  23003. +  HOWTO (R_PPC_GOT16,        /* type */
  23004. +     0,            /* rightshift */
  23005. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23006. +     16,            /* bitsize */
  23007. +     false,            /* pc_relative */
  23008. +     0,            /* bitpos */
  23009. +     complain_overflow_signed, /* complain_on_overflow */
  23010. +     bfd_elf_generic_reloc,    /* special_function */
  23011. +     "R_PPC_GOT16",        /* name */
  23012. +     false,            /* partial_inplace */
  23013. +     0,            /* src_mask */
  23014. +     0xffff,        /* dst_mask */
  23015. +     false),        /* pcrel_offset */
  23016. +
  23017. +  /* Like R_PPC_ADDR16_LO, but referring to the GOT table entry for
  23018. +     the symbol.  */
  23019. +  HOWTO (R_PPC_GOT16_LO,    /* type */
  23020. +     0,            /* rightshift */
  23021. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23022. +     16,            /* bitsize */
  23023. +     false,            /* pc_relative */
  23024. +     0,            /* bitpos */
  23025. +     complain_overflow_dont, /* complain_on_overflow */
  23026. +     bfd_elf_generic_reloc,    /* special_function */
  23027. +     "R_PPC_GOT16_LO",    /* name */
  23028. +     false,            /* partial_inplace */
  23029. +     0,            /* src_mask */
  23030. +     0xffff,        /* dst_mask */
  23031. +     false),        /* pcrel_offset */
  23032. +
  23033. +  /* Like R_PPC_ADDR16_HI, but referring to the GOT table entry for
  23034. +     the symbol.  */
  23035. +  HOWTO (R_PPC_GOT16_HI,    /* type */
  23036. +     16,            /* rightshift */
  23037. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23038. +     16,            /* bitsize */
  23039. +     false,            /* pc_relative */
  23040. +     0,            /* bitpos */
  23041. +     complain_overflow_bitfield, /* complain_on_overflow */
  23042. +     bfd_elf_generic_reloc,    /* special_function */
  23043. +     "R_PPC_GOT16_HI",    /* name */
  23044. +     false,            /* partial_inplace */
  23045. +     0,            /* src_mask */
  23046. +     0xffff,        /* dst_mask */
  23047. +     false),         /* pcrel_offset */
  23048. +
  23049. +  /* Like R_PPC_ADDR16_HA, but referring to the GOT table entry for
  23050. +     the symbol.  */
  23051. +  HOWTO (R_PPC_GOT16_HA,    /* type */
  23052. +     16,            /* rightshift */
  23053. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23054. +     16,            /* bitsize */
  23055. +     false,            /* pc_relative */
  23056. +     0,            /* bitpos */
  23057. +     complain_overflow_bitfield, /* complain_on_overflow */
  23058. +     ppc_elf_addr16_ha_reloc, /* special_function */
  23059. +     "R_PPC_GOT16_HA",    /* name */
  23060. +     false,            /* partial_inplace */
  23061. +     0,            /* src_mask */
  23062. +     0xffff,        /* dst_mask */
  23063. +     false),        /* pcrel_offset */
  23064. +
  23065. +  /* Like R_PPC_REL24, but referring to the procedure linkage table
  23066. +     entry for the symbol.  */
  23067. +  HOWTO (R_PPC_PLTREL24,    /* type */
  23068. +     0,            /* rightshift */
  23069. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23070. +     26,            /* bitsize */
  23071. +     true,            /* pc_relative */
  23072. +     0,            /* bitpos */
  23073. +     complain_overflow_signed,  /* complain_on_overflow */
  23074. +     bfd_elf_generic_reloc,    /* special_function */
  23075. +     "R_PPC_PLTREL24",    /* name */
  23076. +     false,            /* partial_inplace */
  23077. +     0,            /* src_mask */
  23078. +     0x3fffffc,        /* dst_mask */
  23079. +     true),            /* pcrel_offset */
  23080. +
  23081. +  /* This is used only by the dynamic linker.  The symbol should exist
  23082. +     both in the object being run and in some shared library.  The
  23083. +     dynamic linker copies the data addressed by the symbol from the
  23084. +     shared library into the object, because the object being
  23085. +     run has to have the data at some particular address.  */
  23086. +  HOWTO (R_PPC_COPY,        /* type */
  23087. +     0,            /* rightshift */
  23088. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23089. +     32,            /* bitsize */
  23090. +     false,            /* pc_relative */
  23091. +     0,            /* bitpos */
  23092. +     complain_overflow_bitfield, /* complain_on_overflow */
  23093. +     bfd_elf_generic_reloc,     /* special_function */
  23094. +     "R_PPC_COPY",        /* name */
  23095. +     false,            /* partial_inplace */
  23096. +     0,            /* src_mask */
  23097. +     0,            /* dst_mask */
  23098. +     false),        /* pcrel_offset */
  23099. +
  23100. +  /* Like R_PPC_ADDR32, but used when setting global offset table
  23101. +     entries.  */
  23102. +  HOWTO (R_PPC_GLOB_DAT,    /* type */
  23103. +     0,            /* rightshift */
  23104. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23105. +     32,            /* bitsize */
  23106. +     false,            /* pc_relative */
  23107. +     0,            /* bitpos */
  23108. +     complain_overflow_bitfield, /* complain_on_overflow */
  23109. +     bfd_elf_generic_reloc,     /* special_function */
  23110. +     "R_PPC_GLOB_DAT",    /* name */
  23111. +     false,            /* partial_inplace */
  23112. +     0,            /* src_mask */
  23113. +     0xffffffff,        /* dst_mask */
  23114. +     false),        /* pcrel_offset */
  23115. +
  23116. +  /* Marks a procedure linkage table entry for a symbol.  */
  23117. +  HOWTO (R_PPC_JMP_SLOT,    /* type */
  23118. +     0,            /* rightshift */
  23119. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23120. +     32,            /* bitsize */
  23121. +     false,            /* pc_relative */
  23122. +     0,            /* bitpos */
  23123. +     complain_overflow_bitfield, /* complain_on_overflow */
  23124. +     bfd_elf_generic_reloc,     /* special_function */
  23125. +     "R_PPC_JMP_SLOT",    /* name */
  23126. +     false,            /* partial_inplace */
  23127. +     0,            /* src_mask */
  23128. +     0,            /* dst_mask */
  23129. +     false),        /* pcrel_offset */
  23130. +
  23131. +  /* Used only by the dynamic linker.  When the object is run, this
  23132. +     longword is set to the load address of the object, plus the
  23133. +     addend.  */
  23134. +  HOWTO (R_PPC_RELATIVE,    /* type */
  23135. +     0,            /* rightshift */
  23136. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23137. +     32,            /* bitsize */
  23138. +     false,            /* pc_relative */
  23139. +     0,            /* bitpos */
  23140. +     complain_overflow_bitfield, /* complain_on_overflow */
  23141. +     bfd_elf_generic_reloc,     /* special_function */
  23142. +     "R_PPC_RELATIVE",    /* name */
  23143. +     false,            /* partial_inplace */
  23144. +     0,            /* src_mask */
  23145. +     0xffffffff,        /* dst_mask */
  23146. +     false),        /* pcrel_offset */
  23147. +
  23148. +  /* Like R_PPC_REL24, but uses the value of the symbol within the
  23149. +     object rather than the final value.  Normally used for
  23150. +     _GLOBAL_OFFSET_TABLE_.  */
  23151. +  HOWTO (R_PPC_LOCAL24PC,    /* type */
  23152. +     0,            /* rightshift */
  23153. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23154. +     26,            /* bitsize */
  23155. +     true,            /* pc_relative */
  23156. +     0,            /* bitpos */
  23157. +     complain_overflow_signed, /* complain_on_overflow */
  23158. +     bfd_elf_generic_reloc,    /* special_function */
  23159. +     "R_PPC_LOCAL24PC",    /* name */
  23160. +     false,            /* partial_inplace */
  23161. +     0,            /* src_mask */
  23162. +     0x3fffffc,        /* dst_mask */
  23163. +     true),            /* pcrel_offset */
  23164. +
  23165. +  /* Like R_PPC_ADDR32, but may be unaligned.  */
  23166. +  HOWTO (R_PPC_UADDR32,        /* type */
  23167. +     0,            /* rightshift */
  23168. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23169. +     32,            /* bitsize */
  23170. +     false,            /* pc_relative */
  23171. +     0,            /* bitpos */
  23172. +     complain_overflow_bitfield, /* complain_on_overflow */
  23173. +     bfd_elf_generic_reloc,    /* special_function */
  23174. +     "R_PPC_UADDR32",    /* name */
  23175. +     false,            /* partial_inplace */
  23176. +     0,            /* src_mask */
  23177. +     0xffffffff,        /* dst_mask */
  23178. +     false),        /* pcrel_offset */
  23179. +
  23180. +  /* Like R_PPC_ADDR16, but may be unaligned.  */
  23181. +  HOWTO (R_PPC_UADDR16,        /* type */
  23182. +     0,            /* rightshift */
  23183. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23184. +     16,            /* bitsize */
  23185. +     false,            /* pc_relative */
  23186. +     0,            /* bitpos */
  23187. +     complain_overflow_bitfield, /* complain_on_overflow */
  23188. +     bfd_elf_generic_reloc,    /* special_function */
  23189. +     "R_PPC_UADDR16",    /* name */
  23190. +     false,            /* partial_inplace */
  23191. +     0,            /* src_mask */
  23192. +     0xffff,        /* dst_mask */
  23193. +     false),        /* pcrel_offset */
  23194. +
  23195. +  /* 32-bit PC relative */
  23196. +  HOWTO (R_PPC_REL32,        /* type */
  23197. +     0,            /* rightshift */
  23198. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23199. +     32,            /* bitsize */
  23200. +     true,            /* pc_relative */
  23201. +     0,            /* bitpos */
  23202. +     complain_overflow_bitfield, /* complain_on_overflow */
  23203. +     bfd_elf_generic_reloc,    /* special_function */
  23204. +     "R_PPC_REL32",        /* name */
  23205. +     false,            /* partial_inplace */
  23206. +     0,            /* src_mask */
  23207. +     0xffffffff,        /* dst_mask */
  23208. +     true),            /* pcrel_offset */
  23209. +
  23210. +  /* 32-bit relocation to the symbol's procedure linkage table.
  23211. +     FIXME: not supported.  */
  23212. +  HOWTO (R_PPC_PLT32,        /* type */
  23213. +     0,            /* rightshift */
  23214. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23215. +     32,            /* bitsize */
  23216. +     false,            /* pc_relative */
  23217. +     0,            /* bitpos */
  23218. +     complain_overflow_bitfield, /* complain_on_overflow */
  23219. +     bfd_elf_generic_reloc,    /* special_function */
  23220. +     "R_PPC_PLT32",        /* name */
  23221. +     false,            /* partial_inplace */
  23222. +     0,            /* src_mask */
  23223. +     0,            /* dst_mask */
  23224. +     false),        /* pcrel_offset */
  23225. +
  23226. +  /* 32-bit PC relative relocation to the symbol's procedure linkage table.
  23227. +     FIXME: not supported.  */
  23228. +  HOWTO (R_PPC_PLTREL32,    /* type */
  23229. +     0,            /* rightshift */
  23230. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23231. +     32,            /* bitsize */
  23232. +     true,            /* pc_relative */
  23233. +     0,            /* bitpos */
  23234. +     complain_overflow_bitfield, /* complain_on_overflow */
  23235. +     bfd_elf_generic_reloc,    /* special_function */
  23236. +     "R_PPC_PLTREL32",    /* name */
  23237. +     false,            /* partial_inplace */
  23238. +     0,            /* src_mask */
  23239. +     0,            /* dst_mask */
  23240. +     true),            /* pcrel_offset */
  23241. +
  23242. +  /* Like R_PPC_ADDR16_LO, but referring to the PLT table entry for
  23243. +     the symbol.  */
  23244. +  HOWTO (R_PPC_PLT16_LO,    /* type */
  23245. +     0,            /* rightshift */
  23246. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23247. +     16,            /* bitsize */
  23248. +     false,            /* pc_relative */
  23249. +     0,            /* bitpos */
  23250. +     complain_overflow_dont, /* complain_on_overflow */
  23251. +     bfd_elf_generic_reloc,    /* special_function */
  23252. +     "R_PPC_PLT16_LO",    /* name */
  23253. +     false,            /* partial_inplace */
  23254. +     0,            /* src_mask */
  23255. +     0xffff,        /* dst_mask */
  23256. +     false),        /* pcrel_offset */
  23257. +
  23258. +  /* Like R_PPC_ADDR16_HI, but referring to the PLT table entry for
  23259. +     the symbol.  */
  23260. +  HOWTO (R_PPC_PLT16_HI,    /* type */
  23261. +     16,            /* rightshift */
  23262. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23263. +     16,            /* bitsize */
  23264. +     false,            /* pc_relative */
  23265. +     0,            /* bitpos */
  23266. +     complain_overflow_bitfield, /* complain_on_overflow */
  23267. +     bfd_elf_generic_reloc,    /* special_function */
  23268. +     "R_PPC_PLT16_HI",    /* name */
  23269. +     false,            /* partial_inplace */
  23270. +     0,            /* src_mask */
  23271. +     0xffff,        /* dst_mask */
  23272. +     false),         /* pcrel_offset */
  23273. +
  23274. +  /* Like R_PPC_ADDR16_HA, but referring to the PLT table entry for
  23275. +     the symbol.  */
  23276. +  HOWTO (R_PPC_PLT16_HA,    /* type */
  23277. +     16,            /* rightshift */
  23278. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23279. +     16,            /* bitsize */
  23280. +     false,            /* pc_relative */
  23281. +     0,            /* bitpos */
  23282. +     complain_overflow_bitfield, /* complain_on_overflow */
  23283. +     ppc_elf_addr16_ha_reloc, /* special_function */
  23284. +     "R_PPC_PLT16_HA",    /* name */
  23285. +     false,            /* partial_inplace */
  23286. +     0,            /* src_mask */
  23287. +     0xffff,        /* dst_mask */
  23288. +     false),        /* pcrel_offset */
  23289. +
  23290. +  /* A sign-extended 16 bit value relative to _SDA_BASE_, for use with
  23291. +     small data items.  */
  23292. +  HOWTO (R_PPC_SDAREL16,    /* type */
  23293. +     0,            /* rightshift */
  23294. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23295. +     16,            /* bitsize */
  23296. +     false,            /* pc_relative */
  23297. +     0,            /* bitpos */
  23298. +     complain_overflow_signed, /* complain_on_overflow */
  23299. +     bfd_elf_generic_reloc,    /* special_function */
  23300. +     "R_PPC_SDAREL16",    /* name */
  23301. +     false,            /* partial_inplace */
  23302. +     0,            /* src_mask */
  23303. +     0xffff,        /* dst_mask */
  23304. +     false),        /* pcrel_offset */
  23305. +
  23306. +  /* 16-bit section relative relocation.  */
  23307. +  HOWTO (R_PPC_SECTOFF,        /* type */
  23308. +     0,            /* rightshift */
  23309. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23310. +     16,            /* bitsize */
  23311. +     false,            /* pc_relative */
  23312. +     0,            /* bitpos */
  23313. +     complain_overflow_bitfield, /* complain_on_overflow */
  23314. +     bfd_elf_generic_reloc,    /* special_function */
  23315. +     "R_PPC_SECTOFF",    /* name */
  23316. +     false,            /* partial_inplace */
  23317. +     0,            /* src_mask */
  23318. +     0xffff,        /* dst_mask */
  23319. +     false),        /* pcrel_offset */
  23320. +
  23321. +  /* 16-bit lower half section relative relocation.  */
  23322. +  HOWTO (R_PPC_SECTOFF_LO,      /* type */
  23323. +     0,            /* rightshift */
  23324. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23325. +     16,            /* bitsize */
  23326. +     false,            /* pc_relative */
  23327. +     0,            /* bitpos */
  23328. +     complain_overflow_dont, /* complain_on_overflow */
  23329. +     bfd_elf_generic_reloc,    /* special_function */
  23330. +     "R_PPC_SECTOFF_LO",    /* name */
  23331. +     false,            /* partial_inplace */
  23332. +     0,            /* src_mask */
  23333. +     0xffff,        /* dst_mask */
  23334. +     false),        /* pcrel_offset */
  23335. +
  23336. +  /* 16-bit upper half section relative relocation.  */
  23337. +  HOWTO (R_PPC_SECTOFF_HI,    /* type */
  23338. +     16,            /* rightshift */
  23339. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23340. +     16,            /* bitsize */
  23341. +     false,            /* pc_relative */
  23342. +     0,            /* bitpos */
  23343. +     complain_overflow_bitfield, /* complain_on_overflow */
  23344. +     bfd_elf_generic_reloc,    /* special_function */
  23345. +     "R_PPC_SECTOFF_HI",    /* name */
  23346. +     false,            /* partial_inplace */
  23347. +     0,            /* src_mask */
  23348. +     0xffff,        /* dst_mask */
  23349. +     false),         /* pcrel_offset */
  23350. +
  23351. +  /* 16-bit upper half adjusted section relative relocation.  */
  23352. +  HOWTO (R_PPC_SECTOFF_HA,    /* type */
  23353. +     16,            /* rightshift */
  23354. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23355. +     16,            /* bitsize */
  23356. +     false,            /* pc_relative */
  23357. +     0,            /* bitpos */
  23358. +     complain_overflow_bitfield, /* complain_on_overflow */
  23359. +     ppc_elf_addr16_ha_reloc, /* special_function */
  23360. +     "R_PPC_SECTOFF_HA",    /* name */
  23361. +     false,            /* partial_inplace */
  23362. +     0,            /* src_mask */
  23363. +     0xffff,        /* dst_mask */
  23364. +     false),        /* pcrel_offset */
  23365. +
  23366. +  /* The remaining relocs are from the Embedded ELF ABI, and are not
  23367. +     in the SVR4 ELF ABI.  */
  23368. +
  23369. +  /* 32 bit value resulting from the addend minus the symbol */
  23370. +  HOWTO (R_PPC_EMB_NADDR32,    /* type */
  23371. +     0,            /* rightshift */
  23372. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23373. +     32,            /* bitsize */
  23374. +     false,            /* pc_relative */
  23375. +     0,            /* bitpos */
  23376. +     complain_overflow_bitfield, /* complain_on_overflow */
  23377. +     bfd_elf_generic_reloc,    /* special_function */
  23378. +     "R_PPC_EMB_NADDR32",    /* name */
  23379. +     false,            /* partial_inplace */
  23380. +     0,            /* src_mask */
  23381. +     0xffffffff,        /* dst_mask */
  23382. +     false),        /* pcrel_offset */
  23383. +
  23384. +  /* 16 bit value resulting from the addend minus the symbol */
  23385. +  HOWTO (R_PPC_EMB_NADDR16,    /* type */
  23386. +     0,            /* rightshift */
  23387. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23388. +     16,            /* bitsize */
  23389. +     false,            /* pc_relative */
  23390. +     0,            /* bitpos */
  23391. +     complain_overflow_bitfield, /* complain_on_overflow */
  23392. +     bfd_elf_generic_reloc,    /* special_function */
  23393. +     "R_PPC_EMB_NADDR16",    /* name */
  23394. +     false,            /* partial_inplace */
  23395. +     0,            /* src_mask */
  23396. +     0xffff,        /* dst_mask */
  23397. +     false),        /* pcrel_offset */
  23398. +
  23399. +  /* 16 bit value resulting from the addend minus the symbol */
  23400. +  HOWTO (R_PPC_EMB_NADDR16_LO,    /* type */
  23401. +     0,            /* rightshift */
  23402. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23403. +     16,            /* bitsize */
  23404. +     false,            /* pc_relative */
  23405. +     0,            /* bitpos */
  23406. +     complain_overflow_dont,/* complain_on_overflow */
  23407. +     bfd_elf_generic_reloc,    /* special_function */
  23408. +     "R_PPC_EMB_ADDR16_LO",    /* name */
  23409. +     false,            /* partial_inplace */
  23410. +     0,            /* src_mask */
  23411. +     0xffff,        /* dst_mask */
  23412. +     false),        /* pcrel_offset */
  23413. +
  23414. +  /* The high order 16 bits of the addend minus the symbol */
  23415. +  HOWTO (R_PPC_EMB_NADDR16_HI,    /* type */
  23416. +     16,            /* rightshift */
  23417. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23418. +     16,            /* bitsize */
  23419. +     false,            /* pc_relative */
  23420. +     0,            /* bitpos */
  23421. +     complain_overflow_dont, /* complain_on_overflow */
  23422. +     bfd_elf_generic_reloc,    /* special_function */
  23423. +     "R_PPC_EMB_NADDR16_HI", /* name */
  23424. +     false,            /* partial_inplace */
  23425. +     0,            /* src_mask */
  23426. +     0xffff,        /* dst_mask */
  23427. +     false),        /* pcrel_offset */
  23428. +
  23429. +  /* The high order 16 bits of the result of the addend minus the address,
  23430. +     plus 1 if the contents of the low 16 bits, treated as a signed number,
  23431. +     is negative.  */
  23432. +  HOWTO (R_PPC_EMB_NADDR16_HA,    /* type */
  23433. +     16,            /* rightshift */
  23434. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23435. +     16,            /* bitsize */
  23436. +     false,            /* pc_relative */
  23437. +     0,            /* bitpos */
  23438. +     complain_overflow_dont, /* complain_on_overflow */
  23439. +     ppc_elf_addr16_ha_reloc, /* special_function */
  23440. +     "R_PPC_EMB_NADDR16_HA", /* name */
  23441. +     false,            /* partial_inplace */
  23442. +     0,            /* src_mask */
  23443. +     0xffff,        /* dst_mask */
  23444. +     false),        /* pcrel_offset */
  23445. +
  23446. +  /* 16 bit value resulting from allocating a 4 byte word to hold an
  23447. +     address in the .sdata section, and returning the offset from
  23448. +     _SDA_BASE_ for that relocation */
  23449. +  HOWTO (R_PPC_EMB_SDAI16,    /* type */
  23450. +     0,            /* rightshift */
  23451. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23452. +     16,            /* bitsize */
  23453. +     false,            /* pc_relative */
  23454. +     0,            /* bitpos */
  23455. +     complain_overflow_bitfield, /* complain_on_overflow */
  23456. +     bfd_elf_generic_reloc,    /* special_function */
  23457. +     "R_PPC_EMB_SDAI16",    /* name */
  23458. +     false,            /* partial_inplace */
  23459. +     0,            /* src_mask */
  23460. +     0xffff,        /* dst_mask */
  23461. +     false),        /* pcrel_offset */
  23462. +
  23463. +  /* 16 bit value resulting from allocating a 4 byte word to hold an
  23464. +     address in the .sdata2 section, and returning the offset from
  23465. +     _SDA2_BASE_ for that relocation */
  23466. +  HOWTO (R_PPC_EMB_SDA2I16,    /* type */
  23467. +     0,            /* rightshift */
  23468. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23469. +     16,            /* bitsize */
  23470. +     false,            /* pc_relative */
  23471. +     0,            /* bitpos */
  23472. +     complain_overflow_bitfield, /* complain_on_overflow */
  23473. +     bfd_elf_generic_reloc,    /* special_function */
  23474. +     "R_PPC_EMB_SDA2I16",    /* name */
  23475. +     false,            /* partial_inplace */
  23476. +     0,            /* src_mask */
  23477. +     0xffff,        /* dst_mask */
  23478. +     false),        /* pcrel_offset */
  23479. +
  23480. +  /* A sign-extended 16 bit value relative to _SDA2_BASE_, for use with
  23481. +     small data items.     */
  23482. +  HOWTO (R_PPC_EMB_SDA2REL,    /* type */
  23483. +     0,            /* rightshift */
  23484. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23485. +     16,            /* bitsize */
  23486. +     false,            /* pc_relative */
  23487. +     0,            /* bitpos */
  23488. +     complain_overflow_signed, /* complain_on_overflow */
  23489. +     bfd_elf_generic_reloc,    /* special_function */
  23490. +     "R_PPC_EMB_SDA2REL",    /* name */
  23491. +     false,            /* partial_inplace */
  23492. +     0,            /* src_mask */
  23493. +     0xffff,        /* dst_mask */
  23494. +     false),        /* pcrel_offset */
  23495. +
  23496. +  /* Relocate against either _SDA_BASE_ or _SDA2_BASE_, filling in the 16 bit
  23497. +     signed offset from the appropriate base, and filling in the register
  23498. +     field with the appropriate register (0, 2, or 13).  */
  23499. +  HOWTO (R_PPC_EMB_SDA21,    /* type */
  23500. +     0,            /* rightshift */
  23501. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  23502. +     16,            /* bitsize */
  23503. +     false,            /* pc_relative */
  23504. +     0,            /* bitpos */
  23505. +     complain_overflow_signed, /* complain_on_overflow */
  23506. +     bfd_elf_generic_reloc,    /* special_function */
  23507. +     "R_PPC_EMB_SDA21",    /* name */
  23508. +     false,            /* partial_inplace */
  23509. +     0,            /* src_mask */
  23510. +     0xffff,        /* dst_mask */
  23511. +     false),        /* pcrel_offset */
  23512. +
  23513. +  /* Relocation not handled: R_PPC_EMB_MRKREF */
  23514. +  /* Relocation not handled: R_PPC_EMB_RELSEC16 */
  23515. +  /* Relocation not handled: R_PPC_EMB_RELST_LO */
  23516. +  /* Relocation not handled: R_PPC_EMB_RELST_HI */
  23517. +  /* Relocation not handled: R_PPC_EMB_RELST_HA */
  23518. +  /* Relocation not handled: R_PPC_EMB_BIT_FLD */
  23519. +
  23520. +  /* PC relative relocation against either _SDA_BASE_ or _SDA2_BASE_, filling
  23521. +     in the 16 bit signed offset from the appropriate base, and filling in the
  23522. +     register field with the appropriate register (0, 2, or 13).  */
  23523. +  HOWTO (R_PPC_EMB_RELSDA,    /* type */
  23524. +     0,            /* rightshift */
  23525. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23526. +     16,            /* bitsize */
  23527. +     true,            /* pc_relative */
  23528. +     0,            /* bitpos */
  23529. +     complain_overflow_signed, /* complain_on_overflow */
  23530. +     bfd_elf_generic_reloc,    /* special_function */
  23531. +     "R_PPC_EMB_RELSDA",    /* name */
  23532. +     false,            /* partial_inplace */
  23533. +     0,            /* src_mask */
  23534. +     0xffff,        /* dst_mask */
  23535. +     false),        /* pcrel_offset */
  23536. +
  23537. +  /* GNU extension to record C++ vtable hierarchy */
  23538. +  HOWTO (R_PPC_GNU_VTINHERIT,    /* type */
  23539. +     0,            /* rightshift */
  23540. +     0,            /* size (0 = byte, 1 = short, 2 = long) */
  23541. +     0,            /* bitsize */
  23542. +     false,            /* pc_relative */
  23543. +     0,            /* bitpos */
  23544. +     complain_overflow_dont, /* complain_on_overflow */
  23545. +     NULL,            /* special_function */
  23546. +     "R_PPC_GNU_VTINHERIT",    /* name */
  23547. +     false,            /* partial_inplace */
  23548. +     0,            /* src_mask */
  23549. +     0,            /* dst_mask */
  23550. +     false),        /* pcrel_offset */
  23551. +
  23552. +  /* GNU extension to record C++ vtable member usage */
  23553. +  HOWTO (R_PPC_GNU_VTENTRY,    /* type */
  23554. +     0,            /* rightshift */
  23555. +     0,            /* size (0 = byte, 1 = short, 2 = long) */
  23556. +     0,            /* bitsize */
  23557. +     false,            /* pc_relative */
  23558. +     0,            /* bitpos */
  23559. +     complain_overflow_dont, /* complain_on_overflow */
  23560. +     NULL,            /* special_function */
  23561. +     "R_PPC_GNU_VTENTRY",    /* name */
  23562. +     false,            /* partial_inplace */
  23563. +     0,            /* src_mask */
  23564. +     0,            /* dst_mask */
  23565. +     false),        /* pcrel_offset */
  23566. +
  23567. +  /* Phony reloc to handle AIX style TOC entries */
  23568. +  HOWTO (R_PPC_TOC16,        /* type */
  23569. +     0,            /* rightshift */
  23570. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  23571. +     16,            /* bitsize */
  23572. +     false,            /* pc_relative */
  23573. +     0,            /* bitpos */
  23574. +     complain_overflow_signed, /* complain_on_overflow */
  23575. +     bfd_elf_generic_reloc,    /* special_function */
  23576. +     "R_PPC_TOC16",        /* name */
  23577. +     false,            /* partial_inplace */
  23578. +     0,            /* src_mask */
  23579. +     0xffff,        /* dst_mask */
  23580. +     false),        /* pcrel_offset */
  23581. +};
  23582. +
  23583. +/* Initialize the ppc_elf_howto_table, so that linear accesses can be done.  */
  23584. +
  23585. +static void
  23586. +ppc_elf_howto_init ()
  23587. +{
  23588. +  unsigned int i, type;
  23589. +
  23590. +  for (i = 0; i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); i++)
  23591. +    {
  23592. +      type = ppc_elf_howto_raw[i].type;
  23593. +      BFD_ASSERT (type < sizeof (ppc_elf_howto_table) / sizeof (ppc_elf_howto_table[0]));
  23594. +      ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i];
  23595. +    }
  23596. +}
  23597. +
  23598. +/* This function handles relaxing for the PPC with option --mpc860c0[=<n>].
  23599. +
  23600. +   The MPC860, revision C0 or earlier contains a bug in the die.
  23601. +   If all of the following conditions are true, the next instruction
  23602. +   to be executed *may* be treated as a no-op.
  23603. +   1/ A forward branch is executed.
  23604. +   2/ The branch is predicted as not taken.
  23605. +   3/ The branch is taken.
  23606. +   4/ The branch is located in the last 5 words of a page.
  23607. +      (The EOP limit is 5 by default but may be specified as any value from 1-10.)
  23608. +
  23609. +   Our software solution is to detect these problematic branches in a
  23610. +   linker pass and modify them as follows:
  23611. +   1/ Unconditional branches - Since these are always predicted taken,
  23612. +      there is no problem and no action is required.
  23613. +   2/ Conditional backward branches - No problem, no action required.
  23614. +   3/ Conditional forward branches - Ensure that the "inverse prediction
  23615. +      bit" is set (ensure it is predicted taken).
  23616. +   4/ Conditional register branches - Ensure that the "y bit" is set
  23617. +      (ensure it is predicted taken).
  23618. +*/
  23619. +
  23620. +/* Sort sections by address.  */
  23621. +
  23622. +static int
  23623. +ppc_elf_sort_rela (arg1, arg2)
  23624. +     const PTR arg1;
  23625. +     const PTR arg2;
  23626. +{
  23627. +  const Elf_Internal_Rela **rela1 = (const Elf_Internal_Rela**) arg1;
  23628. +  const Elf_Internal_Rela **rela2 = (const Elf_Internal_Rela**) arg2;
  23629. +
  23630. +  /* Sort by offset.  */
  23631. +  return ((*rela1)->r_offset - (*rela2)->r_offset);
  23632. +}
  23633. +
  23634. +static boolean
  23635. +ppc_elf_relax_section (abfd, isec, link_info, again)
  23636. +     bfd *abfd;
  23637. +     asection *isec;
  23638. +     struct bfd_link_info *link_info;
  23639. +     boolean *again;
  23640. +{
  23641. +#define PAGESIZE 0x1000
  23642. +
  23643. +  bfd_byte *contents = NULL;
  23644. +  bfd_byte *free_contents = NULL;
  23645. +  Elf_Internal_Rela *internal_relocs = NULL;
  23646. +  Elf_Internal_Rela *free_relocs = NULL;
  23647. +  Elf_Internal_Rela **rela_comb = NULL;
  23648. +  int comb_curr, comb_count;
  23649. +
  23650. +  /* We never have to do this more than once per input section.  */
  23651. +  *again = false;
  23652. +
  23653. +  /* If needed, initialize this section's cooked size.  */
  23654. +  if (isec->_cooked_size == 0)
  23655. +      isec->_cooked_size = isec->_raw_size;
  23656. +
  23657. +  /* We're only interested in text sections which overlap the
  23658. +     troublesome area at the end of a page.  */
  23659. +  if (link_info->mpc860c0 && (isec->flags & SEC_CODE) && isec->_cooked_size)
  23660. +    {
  23661. +      bfd_vma dot, end_page, end_section;
  23662. +      boolean section_modified;
  23663. +
  23664. +      /* Get the section contents.  */
  23665. +      /* Get cached copy if it exists.  */
  23666. +      if (elf_section_data (isec)->this_hdr.contents != NULL)
  23667. +      contents = elf_section_data (isec)->this_hdr.contents;
  23668. +      else
  23669. +    {
  23670. +      /* Go get them off disk.  */
  23671. +      contents = (bfd_byte *) bfd_malloc (isec->_raw_size);
  23672. +      if (contents == NULL)
  23673. +        goto error_return;
  23674. +      free_contents = contents;
  23675. +
  23676. +      if (! bfd_get_section_contents (abfd, isec, contents,
  23677. +                      (file_ptr) 0, isec->_raw_size))
  23678. +        goto error_return;
  23679. +    }
  23680. +
  23681. +      comb_curr = 0;
  23682. +      comb_count = 0;
  23683. +      if (isec->reloc_count)
  23684. +    {
  23685. +          unsigned n;
  23686. +      bfd_size_type amt;
  23687. +
  23688. +          /* Get a copy of the native relocations.  */
  23689. +          internal_relocs = _bfd_elf32_link_read_relocs (
  23690. +            abfd, isec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
  23691. +            link_info->keep_memory);
  23692. +          if (internal_relocs == NULL)
  23693. +              goto error_return;
  23694. +          if (! link_info->keep_memory)
  23695. +              free_relocs = internal_relocs;
  23696. +
  23697. +          /* Setup a faster access method for the reloc info we need.  */
  23698. +      amt = isec->reloc_count;
  23699. +      amt *= sizeof (Elf_Internal_Rela*);
  23700. +          rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt);
  23701. +          if (rela_comb == NULL)
  23702. +              goto error_return;
  23703. +          for (n = 0; n < isec->reloc_count; ++n)
  23704. +            {
  23705. +              long r_type;
  23706. +
  23707. +              r_type = ELF32_R_TYPE (internal_relocs[n].r_info);
  23708. +              if (r_type < 0 || r_type >= (int) R_PPC_max)
  23709. +                  goto error_return;
  23710. +
  23711. +              /* Prologue constants are sometimes present in the ".text"
  23712. +              sections and they can be identified by their associated relocation.
  23713. +              We don't want to process those words and some others which
  23714. +              can also be identified by their relocations.  However, not all
  23715. +              conditional branches will have a relocation so we will
  23716. +              only ignore words that 1) have a reloc, and 2) the reloc
  23717. +              is not applicable to a conditional branch.
  23718. +              The array rela_comb is built here for use in the EOP scan loop.  */
  23719. +              switch (r_type)
  23720. +                {
  23721. +                case R_PPC_ADDR14_BRNTAKEN:     /* absolute, predicted not taken */
  23722. +                case R_PPC_REL14:               /* relative cond. br.  */
  23723. +                case R_PPC_REL14_BRNTAKEN:      /* rel. cond. br., predicted not taken */
  23724. +                  /* We should check the instruction.  */
  23725. +                  break;
  23726. +                default:
  23727. +                  /* The word is not a conditional branch - ignore it.  */
  23728. +                  rela_comb[comb_count++] = &internal_relocs[n];
  23729. +                  break;
  23730. +                }
  23731. +            }
  23732. +          if (comb_count > 1)
  23733. +        qsort (rela_comb, (size_t) comb_count, sizeof (int), ppc_elf_sort_rela);
  23734. +    }
  23735. +
  23736. +      /* Enumerate each EOP region that overlaps this section.  */
  23737. +      end_section = isec->vma + isec->_cooked_size;
  23738. +      dot = end_page = (isec->vma | (PAGESIZE - 1)) + 1;
  23739. +      dot -= link_info->mpc860c0;
  23740. +      section_modified = false;
  23741. +      if (dot < isec->vma)      /* Increment the start position if this section */
  23742. +          dot = isec->vma;      /* begins in the middle of its first EOP region.  */
  23743. +      for (;
  23744. +           dot < end_section;
  23745. +           dot += PAGESIZE, end_page += PAGESIZE)
  23746. +        {
  23747. +
  23748. +          /* Check each word in this EOP region.  */
  23749. +          for (; dot < end_page; dot += 4)
  23750. +            {
  23751. +              bfd_vma isec_offset;
  23752. +              unsigned long insn;
  23753. +              boolean skip, modified;
  23754. +
  23755. +              /* Don't process this word if there is a relocation for it and
  23756. +              the relocation indicates the word is not a conditional branch.  */
  23757. +              skip = false;
  23758. +              isec_offset = dot - isec->vma;
  23759. +              for (; comb_curr<comb_count; ++comb_curr)
  23760. +                {
  23761. +                  bfd_vma r_offset;
  23762. +
  23763. +                  r_offset = rela_comb[comb_curr]->r_offset;
  23764. +                  if (r_offset >= isec_offset)
  23765. +                    {
  23766. +                      if (r_offset == isec_offset) skip = true;
  23767. +                      break;
  23768. +                    }
  23769. +                }
  23770. +              if (skip) continue;
  23771. +
  23772. +              /* Check the current word for a problematic conditional branch.  */
  23773. +#define BO0(insn) ((insn) & 0x02000000)
  23774. +#define BO2(insn) ((insn) & 0x00800000)
  23775. +#define BO4(insn) ((insn) & 0x00200000)
  23776. +              insn = (unsigned long) bfd_get_32 (abfd, contents + isec_offset);
  23777. +              modified = false;
  23778. +              if ((insn & 0xFc000000) == 0x40000000)
  23779. +                {
  23780. +                  /* Instruction is BCx */
  23781. +                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
  23782. +                    {
  23783. +                      bfd_vma target;
  23784. +                      /* This branch is predicted as "normal".
  23785. +                      If this is a forward branch, it is problematic.  */
  23786. +
  23787. +                      target = insn & 0x0000Fffc;               /*extract*/
  23788. +                      target = (target ^ 0x8000) - 0x8000;      /*sign extend*/
  23789. +                      if ((insn & 0x00000002) == 0)
  23790. +                          target += dot;                        /*convert to abs*/
  23791. +                      if (target > dot)
  23792. +                        {
  23793. +                          insn |= 0x00200000;   /* set the prediction bit */
  23794. +                          modified = true;
  23795. +                        }
  23796. +                    }
  23797. +                }
  23798. +              else if ((insn & 0xFc00Fffe) == 0x4c000420)
  23799. +                {
  23800. +                  /* Instruction is BCCTRx */
  23801. +                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
  23802. +            {
  23803. +              /* This branch is predicted as not-taken.
  23804. +              If this is a forward branch, it is problematic.
  23805. +                      Since we can't tell statically if it will branch forward,
  23806. +                      always set the prediction bit.  */
  23807. +                      insn |= 0x00200000;   /* set the prediction bit */
  23808. +                      modified = true;
  23809. +            }
  23810. +                }
  23811. +              else if ((insn & 0xFc00Fffe) == 0x4c000020)
  23812. +                {
  23813. +                  /* Instruction is BCLRx */
  23814. +                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
  23815. +            {
  23816. +              /* This branch is predicted as not-taken.
  23817. +              If this is a forward branch, it is problematic.
  23818. +                      Since we can't tell statically if it will branch forward,
  23819. +                      always set the prediction bit.  */
  23820. +                      insn |= 0x00200000;   /* set the prediction bit */
  23821. +                      modified = true;
  23822. +            }
  23823. +                }
  23824. +#undef BO0
  23825. +#undef BO2
  23826. +#undef BO4
  23827. +              if (modified)
  23828. +            {
  23829. +                  bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset);
  23830. +          section_modified = true;
  23831. +            }
  23832. +            }
  23833. +        }
  23834. +      if (section_modified)
  23835. +    {
  23836. +      elf_section_data (isec)->this_hdr.contents = contents;
  23837. +      free_contents = NULL;
  23838. +    }
  23839. +    }
  23840. +
  23841. +  if (rela_comb != NULL)
  23842. +    {
  23843. +      free (rela_comb);
  23844. +      rela_comb = NULL;
  23845. +    }
  23846. +
  23847. +  if (free_relocs != NULL)
  23848. +    {
  23849. +      free (free_relocs);
  23850. +      free_relocs = NULL;
  23851. +    }
  23852. +
  23853. +  if (free_contents != NULL)
  23854. +    {
  23855. +      if (! link_info->keep_memory)
  23856. +    free (free_contents);
  23857. +      else
  23858. +    {
  23859. +      /* Cache the section contents for elf_link_input_bfd.  */
  23860. +      elf_section_data (isec)->this_hdr.contents = contents;
  23861. +    }
  23862. +      free_contents = NULL;
  23863. +    }
  23864. +
  23865. +  return true;
  23866. +
  23867. +error_return:
  23868. +  if (rela_comb != NULL)
  23869. +    free (rela_comb);
  23870. +  if (free_relocs != NULL)
  23871. +    free (free_relocs);
  23872. +  if (free_contents != NULL)
  23873. +    free (free_contents);
  23874. +  return false;
  23875. +}
  23876. +
  23877. +static reloc_howto_type *
  23878. +ppc_elf_reloc_type_lookup (abfd, code)
  23879. +     bfd *abfd ATTRIBUTE_UNUSED;
  23880. +     bfd_reloc_code_real_type code;
  23881. +{
  23882. +  enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
  23883. +
  23884. +  if (!ppc_elf_howto_table[R_PPC_ADDR32])
  23885. +    /* Initialize howto table if needed.  */
  23886. +    ppc_elf_howto_init ();
  23887. +
  23888. +  switch ((int) code)
  23889. +    {
  23890. +    default:
  23891. +      return (reloc_howto_type *) NULL;
  23892. +
  23893. +    case BFD_RELOC_NONE:        ppc_reloc = R_PPC_NONE;            break;
  23894. +    case BFD_RELOC_32:            ppc_reloc = R_PPC_ADDR32;        break;
  23895. +    case BFD_RELOC_PPC_BA26:        ppc_reloc = R_PPC_ADDR24;        break;
  23896. +    case BFD_RELOC_16:            ppc_reloc = R_PPC_ADDR16;        break;
  23897. +    case BFD_RELOC_LO16:        ppc_reloc = R_PPC_ADDR16_LO;        break;
  23898. +    case BFD_RELOC_HI16:        ppc_reloc = R_PPC_ADDR16_HI;        break;
  23899. +    case BFD_RELOC_HI16_S:        ppc_reloc = R_PPC_ADDR16_HA;        break;
  23900. +    case BFD_RELOC_PPC_BA16:        ppc_reloc = R_PPC_ADDR14;        break;
  23901. +    case BFD_RELOC_PPC_BA16_BRTAKEN:    ppc_reloc = R_PPC_ADDR14_BRTAKEN;    break;
  23902. +    case BFD_RELOC_PPC_BA16_BRNTAKEN:    ppc_reloc = R_PPC_ADDR14_BRNTAKEN;    break;
  23903. +    case BFD_RELOC_PPC_B26:        ppc_reloc = R_PPC_REL24;        break;
  23904. +    case BFD_RELOC_PPC_B16:        ppc_reloc = R_PPC_REL14;        break;
  23905. +    case BFD_RELOC_PPC_B16_BRTAKEN:    ppc_reloc = R_PPC_REL14_BRTAKEN;    break;
  23906. +    case BFD_RELOC_PPC_B16_BRNTAKEN:    ppc_reloc = R_PPC_REL14_BRNTAKEN;    break;
  23907. +    case BFD_RELOC_16_GOTOFF:        ppc_reloc = R_PPC_GOT16;        break;
  23908. +    case BFD_RELOC_LO16_GOTOFF:        ppc_reloc = R_PPC_GOT16_LO;        break;
  23909. +    case BFD_RELOC_HI16_GOTOFF:        ppc_reloc = R_PPC_GOT16_HI;        break;
  23910. +    case BFD_RELOC_HI16_S_GOTOFF:    ppc_reloc = R_PPC_GOT16_HA;        break;
  23911. +    case BFD_RELOC_24_PLT_PCREL:    ppc_reloc = R_PPC_PLTREL24;        break;
  23912. +    case BFD_RELOC_PPC_COPY:        ppc_reloc = R_PPC_COPY;            break;
  23913. +    case BFD_RELOC_PPC_GLOB_DAT:    ppc_reloc = R_PPC_GLOB_DAT;        break;
  23914. +    case BFD_RELOC_PPC_LOCAL24PC:    ppc_reloc = R_PPC_LOCAL24PC;        break;
  23915. +    case BFD_RELOC_32_PCREL:        ppc_reloc = R_PPC_REL32;        break;
  23916. +    case BFD_RELOC_32_PLTOFF:        ppc_reloc = R_PPC_PLT32;        break;
  23917. +    case BFD_RELOC_32_PLT_PCREL:    ppc_reloc = R_PPC_PLTREL32;        break;
  23918. +    case BFD_RELOC_LO16_PLTOFF:        ppc_reloc = R_PPC_PLT16_LO;        break;
  23919. +    case BFD_RELOC_HI16_PLTOFF:        ppc_reloc = R_PPC_PLT16_HI;        break;
  23920. +    case BFD_RELOC_HI16_S_PLTOFF:    ppc_reloc = R_PPC_PLT16_HA;        break;
  23921. +    case BFD_RELOC_GPREL16:        ppc_reloc = R_PPC_SDAREL16;        break;
  23922. +    case BFD_RELOC_16_BASEREL:        ppc_reloc = R_PPC_SECTOFF;        break;
  23923. +    case BFD_RELOC_LO16_BASEREL:    ppc_reloc = R_PPC_SECTOFF_LO;        break;
  23924. +    case BFD_RELOC_HI16_BASEREL:    ppc_reloc = R_PPC_SECTOFF_HI;        break;
  23925. +    case BFD_RELOC_HI16_S_BASEREL:    ppc_reloc = R_PPC_SECTOFF_HA;        break;
  23926. +    case BFD_RELOC_CTOR:        ppc_reloc = R_PPC_ADDR32;        break;
  23927. +    case BFD_RELOC_PPC_TOC16:        ppc_reloc = R_PPC_TOC16;        break;
  23928. +    case BFD_RELOC_PPC_EMB_NADDR32:    ppc_reloc = R_PPC_EMB_NADDR32;        break;
  23929. +    case BFD_RELOC_PPC_EMB_NADDR16:    ppc_reloc = R_PPC_EMB_NADDR16;        break;
  23930. +    case BFD_RELOC_PPC_EMB_NADDR16_LO:    ppc_reloc = R_PPC_EMB_NADDR16_LO;    break;
  23931. +    case BFD_RELOC_PPC_EMB_NADDR16_HI:    ppc_reloc = R_PPC_EMB_NADDR16_HI;    break;
  23932. +    case BFD_RELOC_PPC_EMB_NADDR16_HA:    ppc_reloc = R_PPC_EMB_NADDR16_HA;    break;
  23933. +    case BFD_RELOC_PPC_EMB_SDAI16:    ppc_reloc = R_PPC_EMB_SDAI16;        break;
  23934. +    case BFD_RELOC_PPC_EMB_SDA2I16:    ppc_reloc = R_PPC_EMB_SDA2I16;        break;
  23935. +    case BFD_RELOC_PPC_EMB_SDA2REL:    ppc_reloc = R_PPC_EMB_SDA2REL;        break;
  23936. +    case BFD_RELOC_PPC_EMB_SDA21:    ppc_reloc = R_PPC_EMB_SDA21;        break;
  23937. +    case BFD_RELOC_PPC_EMB_MRKREF:    ppc_reloc = R_PPC_EMB_MRKREF;        break;
  23938. +    case BFD_RELOC_PPC_EMB_RELSEC16:    ppc_reloc = R_PPC_EMB_RELSEC16;        break;
  23939. +    case BFD_RELOC_PPC_EMB_RELST_LO:    ppc_reloc = R_PPC_EMB_RELST_LO;        break;
  23940. +    case BFD_RELOC_PPC_EMB_RELST_HI:    ppc_reloc = R_PPC_EMB_RELST_HI;        break;
  23941. +    case BFD_RELOC_PPC_EMB_RELST_HA:    ppc_reloc = R_PPC_EMB_RELST_HA;        break;
  23942. +    case BFD_RELOC_PPC_EMB_BIT_FLD:    ppc_reloc = R_PPC_EMB_BIT_FLD;        break;
  23943. +    case BFD_RELOC_PPC_EMB_RELSDA:    ppc_reloc = R_PPC_EMB_RELSDA;        break;
  23944. +    case BFD_RELOC_VTABLE_INHERIT:    ppc_reloc = R_PPC_GNU_VTINHERIT;    break;
  23945. +    case BFD_RELOC_VTABLE_ENTRY:    ppc_reloc = R_PPC_GNU_VTENTRY;        break;
  23946. +    }
  23947. +
  23948. +  return ppc_elf_howto_table[(int) ppc_reloc];
  23949. +};
  23950. +
  23951. +/* Set the howto pointer for a PowerPC ELF reloc.  */
  23952. +
  23953. +static void
  23954. +ppc_elf_info_to_howto (abfd, cache_ptr, dst)
  23955. +     bfd *abfd ATTRIBUTE_UNUSED;
  23956. +     arelent *cache_ptr;
  23957. +     Elf32_Internal_Rela *dst;
  23958. +{
  23959. +  if (!ppc_elf_howto_table[R_PPC_ADDR32])
  23960. +    /* Initialize howto table if needed.  */
  23961. +    ppc_elf_howto_init ();
  23962. +
  23963. +  BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max);
  23964. +  cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)];
  23965. +}
  23966. +
  23967. +/* Handle the R_PPC_ADDR16_HA reloc.  */
  23968. +
  23969. +static bfd_reloc_status_type
  23970. +ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
  23971. +             output_bfd, error_message)
  23972. +     bfd *abfd ATTRIBUTE_UNUSED;
  23973. +     arelent *reloc_entry;
  23974. +     asymbol *symbol;
  23975. +     PTR data ATTRIBUTE_UNUSED;
  23976. +     asection *input_section;
  23977. +     bfd *output_bfd;
  23978. +     char **error_message ATTRIBUTE_UNUSED;
  23979. +{
  23980. +  bfd_vma relocation;
  23981. +
  23982. +  if (output_bfd != NULL)
  23983. +    {
  23984. +      reloc_entry->address += input_section->output_offset;
  23985. +      return bfd_reloc_ok;
  23986. +    }
  23987. +
  23988. +  if (reloc_entry->address > input_section->_cooked_size)
  23989. +    return bfd_reloc_outofrange;
  23990. +
  23991. +  if (bfd_is_com_section (symbol->section))
  23992. +    relocation = 0;
  23993. +  else
  23994. +    relocation = symbol->value;
  23995. +
  23996. +  relocation += symbol->section->output_section->vma;
  23997. +  relocation += symbol->section->output_offset;
  23998. +  relocation += reloc_entry->addend;
  23999. +
  24000. +  reloc_entry->addend += (relocation & 0x8000) << 1;
  24001. +
  24002. +  return bfd_reloc_continue;
  24003. +}
  24004. +
  24005. +/* Fix bad default arch selected for a 32 bit input bfd when the
  24006. +   default is 64 bit.  */
  24007. +
  24008. +static boolean
  24009. +ppc_elf_object_p (abfd)
  24010. +     bfd *abfd;
  24011. +{
  24012. +  if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 64)
  24013. +    {
  24014. +      Elf_Internal_Ehdr *i_ehdr = elf_elfheader (abfd);
  24015. +
  24016. +      if (i_ehdr->e_ident[EI_CLASS] == ELFCLASS32)
  24017. +    {
  24018. +      /* Relies on arch after 64 bit default being 32 bit default.  */
  24019. +      abfd->arch_info = abfd->arch_info->next;
  24020. +      BFD_ASSERT (abfd->arch_info->bits_per_word == 32);
  24021. +    }
  24022. +    }
  24023. +  return true;
  24024. +}
  24025. +
  24026. +/* Function to set whether a module needs the -mrelocatable bit set.  */
  24027. +
  24028. +static boolean
  24029. +ppc_elf_set_private_flags (abfd, flags)
  24030. +     bfd *abfd;
  24031. +     flagword flags;
  24032. +{
  24033. +  BFD_ASSERT (!elf_flags_init (abfd)
  24034. +          || elf_elfheader (abfd)->e_flags == flags);
  24035. +
  24036. +  elf_elfheader (abfd)->e_flags = flags;
  24037. +  elf_flags_init (abfd) = true;
  24038. +  return true;
  24039. +}
  24040. +
  24041. +/* Merge backend specific data from an object file to the output
  24042. +   object file when linking */
  24043. +static boolean
  24044. +ppc_elf_merge_private_bfd_data (ibfd, obfd)
  24045. +     bfd *ibfd;
  24046. +     bfd *obfd;
  24047. +{
  24048. +  flagword old_flags;
  24049. +  flagword new_flags;
  24050. +  boolean error;
  24051. +
  24052. +  /* Check if we have the same endianess */
  24053. +  if (! _bfd_generic_verify_endian_match (ibfd, obfd))
  24054. +    return false;
  24055. +
  24056. +  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
  24057. +      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
  24058. +    return true;
  24059. +
  24060. +  new_flags = elf_elfheader (ibfd)->e_flags;
  24061. +  old_flags = elf_elfheader (obfd)->e_flags;
  24062. +  if (!elf_flags_init (obfd))    /* First call, no flags set */
  24063. +    {
  24064. +      elf_flags_init (obfd) = true;
  24065. +      elf_elfheader (obfd)->e_flags = new_flags;
  24066. +    }
  24067. +
  24068. +  else if (new_flags == old_flags)    /* Compatible flags are ok */
  24069. +    ;
  24070. +
  24071. +  else                    /* Incompatible flags */
  24072. +    {
  24073. +      /* Warn about -mrelocatable mismatch.  Allow -mrelocatable-lib to be linked
  24074. +         with either.  */
  24075. +      error = false;
  24076. +      if ((new_flags & EF_PPC_RELOCATABLE) != 0
  24077. +      && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0)
  24078. +    {
  24079. +      error = true;
  24080. +      (*_bfd_error_handler)
  24081. +        (_("%s: compiled with -mrelocatable and linked with modules compiled normally"),
  24082. +         bfd_archive_filename (ibfd));
  24083. +    }
  24084. +      else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
  24085. +           && (old_flags & EF_PPC_RELOCATABLE) != 0)
  24086. +    {
  24087. +      error = true;
  24088. +      (*_bfd_error_handler)
  24089. +        (_("%s: compiled normally and linked with modules compiled with -mrelocatable"),
  24090. +         bfd_archive_filename (ibfd));
  24091. +    }
  24092. +
  24093. +      /* The output is -mrelocatable-lib iff both the input files are.  */
  24094. +      if (! (new_flags & EF_PPC_RELOCATABLE_LIB))
  24095. +    elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB;
  24096. +
  24097. +      /* The output is -mrelocatable iff it can't be -mrelocatable-lib,
  24098. +         but each input file is either -mrelocatable or -mrelocatable-lib.  */
  24099. +      if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB)
  24100. +      && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))
  24101. +      && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)))
  24102. +    elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE;
  24103. +
  24104. +      /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if any module uses it */
  24105. +      elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB);
  24106. +
  24107. +      new_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
  24108. +      old_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
  24109. +
  24110. +      /* Warn about any other mismatches */
  24111. +      if (new_flags != old_flags)
  24112. +    {
  24113. +      error = true;
  24114. +      (*_bfd_error_handler)
  24115. +        (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
  24116. +         bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
  24117. +    }
  24118. +
  24119. +      if (error)
  24120. +    {
  24121. +      bfd_set_error (bfd_error_bad_value);
  24122. +      return false;
  24123. +    }
  24124. +    }
  24125. +
  24126. +  return true;
  24127. +}
  24128. +
  24129. +/* Handle a PowerPC specific section when reading an object file.  This
  24130. +   is called when elfcode.h finds a section with an unknown type.  */
  24131. +
  24132. +static boolean
  24133. +ppc_elf_section_from_shdr (abfd, hdr, name)
  24134. +     bfd *abfd;
  24135. +     Elf32_Internal_Shdr *hdr;
  24136. +     const char *name;
  24137. +{
  24138. +  asection *newsect;
  24139. +  flagword flags;
  24140. +
  24141. +  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
  24142. +    return false;
  24143. +
  24144. +  newsect = hdr->bfd_section;
  24145. +  flags = bfd_get_section_flags (abfd, newsect);
  24146. +  if (hdr->sh_flags & SHF_EXCLUDE)
  24147. +    flags |= SEC_EXCLUDE;
  24148. +
  24149. +  if (hdr->sh_type == SHT_ORDERED)
  24150. +    flags |= SEC_SORT_ENTRIES;
  24151. +
  24152. +  bfd_set_section_flags (abfd, newsect, flags);
  24153. +  return true;
  24154. +}
  24155. +
  24156. +/* Set up any other section flags and such that may be necessary.  */
  24157. +
  24158. +static boolean
  24159. +ppc_elf_fake_sections (abfd, shdr, asect)
  24160. +     bfd *abfd ATTRIBUTE_UNUSED;
  24161. +     Elf32_Internal_Shdr *shdr;
  24162. +     asection *asect;
  24163. +{
  24164. +  if ((asect->flags & SEC_EXCLUDE) != 0)
  24165. +    shdr->sh_flags |= SHF_EXCLUDE;
  24166. +
  24167. +  if ((asect->flags & SEC_SORT_ENTRIES) != 0)
  24168. +    shdr->sh_type = SHT_ORDERED;
  24169. +
  24170. +  return true;
  24171. +}
  24172. +
  24173. +/* Create a special linker section */
  24174. +static elf_linker_section_t *
  24175. +ppc_elf_create_linker_section (abfd, info, which)
  24176. +     bfd *abfd;
  24177. +     struct bfd_link_info *info;
  24178. +     enum elf_linker_section_enum which;
  24179. +{
  24180. +  bfd *dynobj = elf_hash_table (info)->dynobj;
  24181. +  elf_linker_section_t *lsect;
  24182. +
  24183. +  /* Record the first bfd section that needs the special section */
  24184. +  if (!dynobj)
  24185. +    dynobj = elf_hash_table (info)->dynobj = abfd;
  24186. +
  24187. +  /* If this is the first time, create the section */
  24188. +  lsect = elf_linker_section (dynobj, which);
  24189. +  if (!lsect)
  24190. +    {
  24191. +      elf_linker_section_t defaults;
  24192. +      static elf_linker_section_t zero_section;
  24193. +
  24194. +      defaults = zero_section;
  24195. +      defaults.which = which;
  24196. +      defaults.hole_written_p = false;
  24197. +      defaults.alignment = 2;
  24198. +
  24199. +      /* Both of these sections are (technically) created by the user
  24200. +     putting data in them, so they shouldn't be marked
  24201. +     SEC_LINKER_CREATED.
  24202. +
  24203. +     The linker creates them so it has somewhere to attach their
  24204. +     respective symbols. In fact, if they were empty it would
  24205. +     be OK to leave the symbol set to 0 (or any random number), because
  24206. +     the appropriate register should never be used.  */
  24207. +      defaults.flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
  24208. +            | SEC_IN_MEMORY);
  24209. +
  24210. +      switch (which)
  24211. +    {
  24212. +    default:
  24213. +      (*_bfd_error_handler) (_("%s: Unknown special linker type %d"),
  24214. +                 bfd_get_filename (abfd),
  24215. +                 (int) which);
  24216. +
  24217. +      bfd_set_error (bfd_error_bad_value);
  24218. +      return (elf_linker_section_t *) 0;
  24219. +
  24220. +    case LINKER_SECTION_SDATA:    /* .sdata/.sbss section */
  24221. +      defaults.name          = ".sdata";
  24222. +      defaults.rel_name      = ".rela.sdata";
  24223. +      defaults.bss_name      = ".sbss";
  24224. +      defaults.sym_name      = "_SDA_BASE_";
  24225. +      defaults.sym_offset      = 32768;
  24226. +      break;
  24227. +
  24228. +    case LINKER_SECTION_SDATA2:    /* .sdata2/.sbss2 section */
  24229. +      defaults.name          = ".sdata2";
  24230. +      defaults.rel_name      = ".rela.sdata2";
  24231. +      defaults.bss_name      = ".sbss2";
  24232. +      defaults.sym_name      = "_SDA2_BASE_";
  24233. +      defaults.sym_offset      = 32768;
  24234. +      defaults.flags     |= SEC_READONLY;
  24235. +      break;
  24236. +    }
  24237. +
  24238. +      lsect = _bfd_elf_create_linker_section (abfd, info, which, &defaults);
  24239. +    }
  24240. +
  24241. +  return lsect;
  24242. +}
  24243. +
  24244. +/* If we have a non-zero sized .sbss2 or .PPC.EMB.sbss0 sections, we
  24245. +   need to bump up the number of section headers.  */
  24246. +
  24247. +static int
  24248. +ppc_elf_additional_program_headers (abfd)
  24249. +     bfd *abfd;
  24250. +{
  24251. +  asection *s;
  24252. +  int ret;
  24253. +
  24254. +  ret = 0;
  24255. +
  24256. +  s = bfd_get_section_by_name (abfd, ".interp");
  24257. +  if (s != NULL)
  24258. +    ++ret;
  24259. +
  24260. +  s = bfd_get_section_by_name (abfd, ".sbss2");
  24261. +  if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
  24262. +    ++ret;
  24263. +
  24264. +  s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0");
  24265. +  if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
  24266. +    ++ret;
  24267. +
  24268. +  return ret;
  24269. +}
  24270. +
  24271. +/* Modify the segment map if needed.  */
  24272. +
  24273. +static boolean
  24274. +ppc_elf_modify_segment_map (abfd)
  24275. +     bfd *abfd ATTRIBUTE_UNUSED;
  24276. +{
  24277. +  return true;
  24278. +}
  24279. +
  24280. +/* The powerpc .got has a blrl instruction in it.  Mark it executable.  */
  24281. +
  24282. +static asection *
  24283. +ppc_elf_create_got (abfd, info)
  24284. +     bfd *abfd;
  24285. +     struct bfd_link_info *info;
  24286. +{
  24287. +  register asection *s;
  24288. +  flagword flags;
  24289. +
  24290. +  if (!_bfd_elf_create_got_section (abfd, info))
  24291. +    return NULL;
  24292. +
  24293. +  s = bfd_get_section_by_name (abfd, ".got");
  24294. +  if (s == NULL)
  24295. +    abort ();
  24296. +
  24297. +  flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY
  24298. +       | SEC_LINKER_CREATED);
  24299. +  if (!bfd_set_section_flags (abfd, s, flags))
  24300. +    return NULL;
  24301. +  return s;
  24302. +}
  24303. +
  24304. +/* We have to create .dynsbss and .rela.sbss here so that they get mapped
  24305. +   to output sections (just like _bfd_elf_create_dynamic_sections has
  24306. +   to create .dynbss and .rela.bss).  */
  24307. +
  24308. +static boolean
  24309. +ppc_elf_create_dynamic_sections (abfd, info)
  24310. +     bfd *abfd;
  24311. +     struct bfd_link_info *info;
  24312. +{
  24313. +  register asection *s;
  24314. +  flagword flags;
  24315. +
  24316. +  if (!ppc_elf_create_got (abfd, info))
  24317. +    return false;
  24318. +
  24319. +  if (!_bfd_elf_create_dynamic_sections (abfd, info))
  24320. +    return false;
  24321. +
  24322. +  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
  24323. +       | SEC_LINKER_CREATED);
  24324. +
  24325. +  s = bfd_make_section (abfd, ".dynsbss");
  24326. +  if (s == NULL
  24327. +      || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
  24328. +    return false;
  24329. +
  24330. +  if (! info->shared)
  24331. +    {
  24332. +      s = bfd_make_section (abfd, ".rela.sbss");
  24333. +      if (s == NULL
  24334. +      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
  24335. +      || ! bfd_set_section_alignment (abfd, s, 2))
  24336. +    return false;
  24337. +    }
  24338. +
  24339. +  s = bfd_get_section_by_name (abfd, ".plt");
  24340. +  if (s == NULL)
  24341. +    abort ();
  24342. +
  24343. +  flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED;
  24344. +  return bfd_set_section_flags (abfd, s, flags);
  24345. +}
  24346. +
  24347. +/* Adjust a symbol defined by a dynamic object and referenced by a
  24348. +   regular object.  The current definition is in some section of the
  24349. +   dynamic object, but we're not including those sections.  We have to
  24350. +   change the definition to something the rest of the link can
  24351. +   understand.  */
  24352. +
  24353. +static boolean
  24354. +ppc_elf_adjust_dynamic_symbol (info, h)
  24355. +     struct bfd_link_info *info;
  24356. +     struct elf_link_hash_entry *h;
  24357. +{
  24358. +  bfd *dynobj = elf_hash_table (info)->dynobj;
  24359. +  asection *s;
  24360. +  unsigned int power_of_two;
  24361. +  bfd_vma plt_offset;
  24362. +
  24363. +#ifdef DEBUG
  24364. +  fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n", h->root.root.string);
  24365. +#endif
  24366. +
  24367. +  /* Make sure we know what is going on here.  */
  24368. +  BFD_ASSERT (dynobj != NULL
  24369. +          && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
  24370. +          || h->weakdef != NULL
  24371. +          || ((h->elf_link_hash_flags
  24372. +               & ELF_LINK_HASH_DEF_DYNAMIC) != 0
  24373. +              && (h->elf_link_hash_flags
  24374. +              & ELF_LINK_HASH_REF_REGULAR) != 0
  24375. +              && (h->elf_link_hash_flags
  24376. +              & ELF_LINK_HASH_DEF_REGULAR) == 0)));
  24377. +
  24378. +  /* If this is a function, put it in the procedure linkage table.  We
  24379. +     will fill in the contents of the procedure linkage table later,
  24380. +     when we know the address of the .got section.  */
  24381. +  if (h->type == STT_FUNC
  24382. +      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
  24383. +    {
  24384. +      if (! elf_hash_table (info)->dynamic_sections_created
  24385. +       || SYMBOL_CALLS_LOCAL (info, h)
  24386. +      || (info->shared && h->plt.refcount <= 0))
  24387. +    {
  24388. +      /* A PLT entry is not required/allowed when:
  24389. +
  24390. +         1. We are not using ld.so; because then the PLT entry
  24391. +         can't be set up, so we can't use one.
  24392. +
  24393. +         2. We know for certain that a call to this symbol
  24394. +         will go to this object.
  24395. +
  24396. +         3. GC has rendered the entry unused.
  24397. +         Note, however, that in an executable all references to the
  24398. +         symbol go to the PLT, so we can't turn it off in that case.
  24399. +         ??? The correct thing to do here is to reference count
  24400. +         all uses of the symbol, not just those to the GOT or PLT.  */
  24401. +      h->plt.offset = (bfd_vma) -1;
  24402. +      h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
  24403. +      return true;
  24404. +    }
  24405. +
  24406. +      /* Make sure this symbol is output as a dynamic symbol.  */
  24407. +      if (h->dynindx == -1)
  24408. +    {
  24409. +      if (! bfd_elf32_link_record_dynamic_symbol (info, h))
  24410. +        return false;
  24411. +    }
  24412. +      BFD_ASSERT (h->dynindx != -1);
  24413. +
  24414. +      s = bfd_get_section_by_name (dynobj, ".plt");
  24415. +      BFD_ASSERT (s != NULL);
  24416. +
  24417. +      /* If this is the first .plt entry, make room for the special
  24418. +     first entry.  */
  24419. +      if (s->_raw_size == 0)
  24420. +    s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
  24421. +
  24422. +      /* The PowerPC PLT is actually composed of two parts, the first part
  24423. +     is 2 words (for a load and a jump), and then there is a remaining
  24424. +     word available at the end.  */
  24425. +      plt_offset = (PLT_INITIAL_ENTRY_SIZE
  24426. +            + (PLT_SLOT_SIZE
  24427. +               * ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE)
  24428. +              / PLT_ENTRY_SIZE)));
  24429. +
  24430. +      /* If this symbol is not defined in a regular file, and we are
  24431. +     not generating a shared library, then set the symbol to this
  24432. +     location in the .plt.  This is required to make function
  24433. +     pointers compare as equal between the normal executable and
  24434. +     the shared library.  */
  24435. +      if (! info->shared
  24436. +      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
  24437. +    {
  24438. +      h->root.u.def.section = s;
  24439. +      h->root.u.def.value = plt_offset;
  24440. +    }
  24441. +
  24442. +      h->plt.offset = plt_offset;
  24443. +
  24444. +      /* Make room for this entry.  After the 8192nd entry, room
  24445. +         for two entries is allocated.  */
  24446. +      if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
  24447. +      >= PLT_NUM_SINGLE_ENTRIES)
  24448. +    s->_raw_size += 2 * PLT_ENTRY_SIZE;
  24449. +      else
  24450. +    s->_raw_size += PLT_ENTRY_SIZE;
  24451. +
  24452. +      /* We also need to make an entry in the .rela.plt section.  */
  24453. +      s = bfd_get_section_by_name (dynobj, ".rela.plt");
  24454. +      BFD_ASSERT (s != NULL);
  24455. +      s->_raw_size += sizeof (Elf32_External_Rela);
  24456. +
  24457. +      return true;
  24458. +    }
  24459. +  else
  24460. +    h->plt.offset = (bfd_vma) -1;
  24461. +
  24462. +  /* If this is a weak symbol, and there is a real definition, the
  24463. +     processor independent code will have arranged for us to see the
  24464. +     real definition first, and we can just use the same value.  */
  24465. +  if (h->weakdef != NULL)
  24466. +    {
  24467. +      BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
  24468. +          || h->weakdef->root.type == bfd_link_hash_defweak);
  24469. +      h->root.u.def.section = h->weakdef->root.u.def.section;
  24470. +      h->root.u.def.value = h->weakdef->root.u.def.value;
  24471. +      return true;
  24472. +    }
  24473. +
  24474. +  /* This is a reference to a symbol defined by a dynamic object which
  24475. +     is not a function.  */
  24476. +
  24477. +  /* If we are creating a shared library, we must presume that the
  24478. +     only references to the symbol are via the global offset table.
  24479. +     For such cases we need not do anything here; the relocations will
  24480. +     be handled correctly by relocate_section.  */
  24481. +  if (info->shared)
  24482. +    return true;
  24483. +
  24484. +  /* We must allocate the symbol in our .dynbss section, which will
  24485. +     become part of the .bss section of the executable.  There will be
  24486. +     an entry for this symbol in the .dynsym section.  The dynamic
  24487. +     object will contain position independent code, so all references
  24488. +     from the dynamic object to this symbol will go through the global
  24489. +     offset table.  The dynamic linker will use the .dynsym entry to
  24490. +     determine the address it must put in the global offset table, so
  24491. +     both the dynamic object and the regular object will refer to the
  24492. +     same memory location for the variable.
  24493. +
  24494. +     Of course, if the symbol is sufficiently small, we must instead
  24495. +     allocate it in .sbss.  FIXME: It would be better to do this if and
  24496. +     only if there were actually SDAREL relocs for that symbol.  */
  24497. +
  24498. +  if (h->size <= elf_gp_size (dynobj))
  24499. +    s = bfd_get_section_by_name (dynobj, ".dynsbss");
  24500. +  else
  24501. +    s = bfd_get_section_by_name (dynobj, ".dynbss");
  24502. +  BFD_ASSERT (s != NULL);
  24503. +
  24504. +  /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
  24505. +     copy the initial value out of the dynamic object and into the
  24506. +     runtime process image.  We need to remember the offset into the
  24507. +     .rela.bss section we are going to use.  */
  24508. +  if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
  24509. +    {
  24510. +      asection *srel;
  24511. +
  24512. +      if (h->size <= elf_gp_size (dynobj))
  24513. +    srel = bfd_get_section_by_name (dynobj, ".rela.sbss");
  24514. +      else
  24515. +    srel = bfd_get_section_by_name (dynobj, ".rela.bss");
  24516. +      BFD_ASSERT (srel != NULL);
  24517. +      srel->_raw_size += sizeof (Elf32_External_Rela);
  24518. +      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
  24519. +    }
  24520. +
  24521. +  /* We need to figure out the alignment required for this symbol.  I
  24522. +     have no idea how ELF linkers handle this.  */
  24523. +  power_of_two = bfd_log2 (h->size);
  24524. +  if (power_of_two > 4)
  24525. +    power_of_two = 4;
  24526. +
  24527. +  /* Apply the required alignment.  */
  24528. +  s->_raw_size = BFD_ALIGN (s->_raw_size,
  24529. +                (bfd_size_type) (1 << power_of_two));
  24530. +  if (power_of_two > bfd_get_section_alignment (dynobj, s))
  24531. +    {
  24532. +      if (! bfd_set_section_alignment (dynobj, s, power_of_two))
  24533. +    return false;
  24534. +    }
  24535. +
  24536. +  /* Define the symbol as being at this point in the section.  */
  24537. +  h->root.u.def.section = s;
  24538. +  h->root.u.def.value = s->_raw_size;
  24539. +
  24540. +  /* Increment the section size to make room for the symbol.  */
  24541. +  s->_raw_size += h->size;
  24542. +
  24543. +  return true;
  24544. +}
  24545. +
  24546. +/* Set the sizes of the dynamic sections.  */
  24547. +
  24548. +static boolean
  24549. +ppc_elf_size_dynamic_sections (output_bfd, info)
  24550. +     bfd *output_bfd ATTRIBUTE_UNUSED;
  24551. +     struct bfd_link_info *info;
  24552. +{
  24553. +  bfd *dynobj;
  24554. +  asection *s;
  24555. +  boolean plt;
  24556. +  boolean relocs;
  24557. +
  24558. +#ifdef DEBUG
  24559. +  fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
  24560. +#endif
  24561. +
  24562. +  dynobj = elf_hash_table (info)->dynobj;
  24563. +  BFD_ASSERT (dynobj != NULL);
  24564. +
  24565. +  if (elf_hash_table (info)->dynamic_sections_created)
  24566. +    {
  24567. +      /* Set the contents of the .interp section to the interpreter.  */
  24568. +      if (! info->shared)
  24569. +    {
  24570. +      s = bfd_get_section_by_name (dynobj, ".interp");
  24571. +      BFD_ASSERT (s != NULL);
  24572. +      s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
  24573. +      s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
  24574. +    }
  24575. +    }
  24576. +  else
  24577. +    {
  24578. +      /* We may have created entries in the .rela.got, .rela.sdata, and
  24579. +     .rela.sdata2 sections.  However, if we are not creating the
  24580. +     dynamic sections, we will not actually use these entries.  Reset
  24581. +     the size of .rela.got, et al, which will cause it to get
  24582. +     stripped from the output file below.  */
  24583. +      static char *rela_sections[] = { ".rela.got", ".rela.sdata",
  24584. +                       ".rela.sdata2", ".rela.sbss",
  24585. +                       (char *) 0 };
  24586. +      char **p;
  24587. +
  24588. +      for (p = rela_sections; *p != (char *) 0; p++)
  24589. +    {
  24590. +      s = bfd_get_section_by_name (dynobj, *p);
  24591. +      if (s != NULL)
  24592. +        s->_raw_size = 0;
  24593. +    }
  24594. +    }
  24595. +
  24596. +  /* The check_relocs and adjust_dynamic_symbol entry points have
  24597. +     determined the sizes of the various dynamic sections.  Allocate
  24598. +     memory for them.  */
  24599. +  plt = false;
  24600. +  relocs = false;
  24601. +  for (s = dynobj->sections; s != NULL; s = s->next)
  24602. +    {
  24603. +      const char *name;
  24604. +      boolean strip;
  24605. +
  24606. +      if ((s->flags & SEC_LINKER_CREATED) == 0)
  24607. +    continue;
  24608. +
  24609. +      /* It's OK to base decisions on the section name, because none
  24610. +     of the dynobj section names depend upon the input files.  */
  24611. +      name = bfd_get_section_name (dynobj, s);
  24612. +
  24613. +      strip = false;
  24614. +
  24615. +      if (strcmp (name, ".plt") == 0)
  24616. +    {
  24617. +      if (s->_raw_size == 0)
  24618. +        {
  24619. +          /* Strip this section if we don't need it; see the
  24620. +                 comment below.  */
  24621. +          strip = true;
  24622. +        }
  24623. +      else
  24624. +        {
  24625. +          /* Remember whether there is a PLT.  */
  24626. +          plt = true;
  24627. +        }
  24628. +    }
  24629. +      else if (strncmp (name, ".rela", 5) == 0)
  24630. +    {
  24631. +      if (s->_raw_size == 0)
  24632. +        {
  24633. +          /* If we don't need this section, strip it from the
  24634. +         output file.  This is mostly to handle .rela.bss and
  24635. +         .rela.plt.  We must create both sections in
  24636. +         create_dynamic_sections, because they must be created
  24637. +         before the linker maps input sections to output
  24638. +         sections.  The linker does that before
  24639. +         adjust_dynamic_symbol is called, and it is that
  24640. +         function which decides whether anything needs to go
  24641. +         into these sections.  */
  24642. +          strip = true;
  24643. +        }
  24644. +      else
  24645. +        {
  24646. +          /* Remember whether there are any relocation sections.  */
  24647. +          relocs = true;
  24648. +
  24649. +          /* We use the reloc_count field as a counter if we need
  24650. +         to copy relocs into the output file.  */
  24651. +          s->reloc_count = 0;
  24652. +        }
  24653. +    }
  24654. +      else if (strcmp (name, ".got") != 0
  24655. +           && strcmp (name, ".sdata") != 0
  24656. +           && strcmp (name, ".sdata2") != 0)
  24657. +    {
  24658. +      /* It's not one of our sections, so don't allocate space.  */
  24659. +      continue;
  24660. +    }
  24661. +
  24662. +      if (strip)
  24663. +    {
  24664. +      _bfd_strip_section_from_output (info, s);
  24665. +      continue;
  24666. +    }
  24667. +
  24668. +      /* Allocate memory for the section contents.  */
  24669. +      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
  24670. +      if (s->contents == NULL && s->_raw_size != 0)
  24671. +    return false;
  24672. +    }
  24673. +
  24674. +  if (elf_hash_table (info)->dynamic_sections_created)
  24675. +    {
  24676. +      /* Add some entries to the .dynamic section.  We fill in the
  24677. +     values later, in ppc_elf_finish_dynamic_sections, but we
  24678. +     must add the entries now so that we get the correct size for
  24679. +     the .dynamic section.  The DT_DEBUG entry is filled in by the
  24680. +     dynamic linker and used by the debugger.  */
  24681. +#define add_dynamic_entry(TAG, VAL) \
  24682. +  bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
  24683. +
  24684. +      if (!info->shared)
  24685. +    {
  24686. +      if (!add_dynamic_entry (DT_DEBUG, 0))
  24687. +        return false;
  24688. +    }
  24689. +
  24690. +      if (plt)
  24691. +    {
  24692. +      if (!add_dynamic_entry (DT_PLTGOT, 0)
  24693. +          || !add_dynamic_entry (DT_PLTRELSZ, 0)
  24694. +          || !add_dynamic_entry (DT_PLTREL, DT_RELA)
  24695. +          || !add_dynamic_entry (DT_JMPREL, 0))
  24696. +        return false;
  24697. +    }
  24698. +
  24699. +      if (relocs)
  24700. +    {
  24701. +      if (!add_dynamic_entry (DT_RELA, 0)
  24702. +          || !add_dynamic_entry (DT_RELASZ, 0)
  24703. +          || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
  24704. +        return false;
  24705. +    }
  24706. +
  24707. +      if ((info->flags & DF_TEXTREL) != 0)
  24708. +    {
  24709. +      if (!add_dynamic_entry (DT_TEXTREL, 0))
  24710. +        return false;
  24711. +      info->flags |= DF_TEXTREL;
  24712. +    }
  24713. +    }
  24714. +#undef add_dynamic_entry
  24715. +
  24716. +  return true;
  24717. +}
  24718. +
  24719. +/* Look through the relocs for a section during the first phase, and
  24720. +   allocate space in the global offset table or procedure linkage
  24721. +   table.  */
  24722. +
  24723. +static boolean
  24724. +ppc_elf_check_relocs (abfd, info, sec, relocs)
  24725. +     bfd *abfd;
  24726. +     struct bfd_link_info *info;
  24727. +     asection *sec;
  24728. +     const Elf_Internal_Rela *relocs;
  24729. +{
  24730. +  bfd *dynobj;
  24731. +  Elf_Internal_Shdr *symtab_hdr;
  24732. +  struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
  24733. +  const Elf_Internal_Rela *rel;
  24734. +  const Elf_Internal_Rela *rel_end;
  24735. +  bfd_signed_vma *local_got_refcounts;
  24736. +  elf_linker_section_t *sdata;
  24737. +  elf_linker_section_t *sdata2;
  24738. +  asection *sreloc;
  24739. +  asection *sgot = NULL;
  24740. +  asection *srelgot = NULL;
  24741. +
  24742. +  if (info->relocateable)
  24743. +    return true;
  24744. +
  24745. +#ifdef DEBUG
  24746. +  fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n",
  24747. +       bfd_get_section_name (abfd, sec),
  24748. +       bfd_archive_filename (abfd));
  24749. +#endif
  24750. +
  24751. +  /* Create the linker generated sections all the time so that the
  24752. +     special symbols are created.  */
  24753. +
  24754. +  if ((sdata = elf_linker_section (abfd, LINKER_SECTION_SDATA)) == NULL)
  24755. +    {
  24756. +      sdata = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA);
  24757. +      if (!sdata)
  24758. +    return false;
  24759. +    }
  24760. +
  24761. +  if ((sdata2 = elf_linker_section (abfd, LINKER_SECTION_SDATA2)) == NULL)
  24762. +    {
  24763. +      sdata2 = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA2);
  24764. +      if (!sdata2)
  24765. +    return false;
  24766. +    }
  24767. +
  24768. +  dynobj = elf_hash_table (info)->dynobj;
  24769. +  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  24770. +  local_got_refcounts = elf_local_got_refcounts (abfd);
  24771. +
  24772. +  sym_hashes = elf_sym_hashes (abfd);
  24773. +  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
  24774. +  if (!elf_bad_symtab (abfd))
  24775. +    sym_hashes_end -= symtab_hdr->sh_info;
  24776. +
  24777. +  sreloc = NULL;
  24778. +
  24779. +  rel_end = relocs + sec->reloc_count;
  24780. +  for (rel = relocs; rel < rel_end; rel++)
  24781. +    {
  24782. +      unsigned long r_symndx;
  24783. +      struct elf_link_hash_entry *h;
  24784. +
  24785. +      r_symndx = ELF32_R_SYM (rel->r_info);
  24786. +      if (r_symndx < symtab_hdr->sh_info)
  24787. +    h = NULL;
  24788. +      else
  24789. +    h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  24790. +
  24791. +      /* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
  24792. +     This shows up in particular in an R_PPC_ADDR32 in the eabi
  24793. +     startup code.  */
  24794. +      if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
  24795. +    {
  24796. +      if (sgot == NULL)
  24797. +        {
  24798. +          if (dynobj == NULL)
  24799. +        elf_hash_table (info)->dynobj = dynobj = abfd;
  24800. +          sgot = ppc_elf_create_got (dynobj, info);
  24801. +          if (sgot == NULL)
  24802. +        return false;
  24803. +        }
  24804. +    }
  24805. +
  24806. +      switch (ELF32_R_TYPE (rel->r_info))
  24807. +    {
  24808. +    /* GOT16 relocations */
  24809. +    case R_PPC_GOT16:
  24810. +    case R_PPC_GOT16_LO:
  24811. +    case R_PPC_GOT16_HI:
  24812. +    case R_PPC_GOT16_HA:
  24813. +      /* This symbol requires a global offset table entry.  */
  24814. +
  24815. +      if (sgot == NULL)
  24816. +        {
  24817. +          if (dynobj == NULL)
  24818. +        elf_hash_table (info)->dynobj = dynobj = abfd;
  24819. +          sgot = ppc_elf_create_got (dynobj, info);
  24820. +          if (sgot == NULL)
  24821. +        return false;
  24822. +        }
  24823. +
  24824. +      if (srelgot == NULL
  24825. +          && (h != NULL || info->shared))
  24826. +        {
  24827. +          srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  24828. +          if (srelgot == NULL)
  24829. +        {
  24830. +          srelgot = bfd_make_section (dynobj, ".rela.got");
  24831. +          if (srelgot == NULL
  24832. +              || ! bfd_set_section_flags (dynobj, srelgot,
  24833. +                          (SEC_ALLOC
  24834. +                           | SEC_LOAD
  24835. +                           | SEC_HAS_CONTENTS
  24836. +                           | SEC_IN_MEMORY
  24837. +                           | SEC_LINKER_CREATED
  24838. +                           | SEC_READONLY))
  24839. +              || ! bfd_set_section_alignment (dynobj, srelgot, 2))
  24840. +            return false;
  24841. +        }
  24842. +        }
  24843. +
  24844. +      if (h != NULL)
  24845. +        {
  24846. +          if (h->got.refcount == 0)
  24847. +        {
  24848. +          /* Make sure this symbol is output as a dynamic symbol.  */
  24849. +          if (h->dynindx == -1)
  24850. +            if (!bfd_elf32_link_record_dynamic_symbol (info, h))
  24851. +              return false;
  24852. +
  24853. +          /* Allocate space in the .got.  */
  24854. +          sgot->_raw_size += 4;
  24855. +          /* Allocate relocation space.  */
  24856. +          srelgot->_raw_size += sizeof (Elf32_External_Rela);
  24857. +        }
  24858. +          h->got.refcount++;
  24859. +        }
  24860. +      else
  24861. +        {
  24862. +          /* This is a global offset table entry for a local symbol.  */
  24863. +          if (local_got_refcounts == NULL)
  24864. +        {
  24865. +          bfd_size_type size;
  24866. +
  24867. +          size = symtab_hdr->sh_info;
  24868. +          size *= sizeof (bfd_signed_vma);
  24869. +          local_got_refcounts
  24870. +            = (bfd_signed_vma *) bfd_zalloc (abfd, size);
  24871. +          if (local_got_refcounts == NULL)
  24872. +            return false;
  24873. +          elf_local_got_refcounts (abfd) = local_got_refcounts;
  24874. +        }
  24875. +          if (local_got_refcounts[r_symndx] == 0)
  24876. +        {
  24877. +          sgot->_raw_size += 4;
  24878. +
  24879. +          /* If we are generating a shared object, we need to
  24880. +                     output a R_PPC_RELATIVE reloc so that the
  24881. +                     dynamic linker can adjust this GOT entry.  */
  24882. +          if (info->shared)
  24883. +            srelgot->_raw_size += sizeof (Elf32_External_Rela);
  24884. +        }
  24885. +          local_got_refcounts[r_symndx]++;
  24886. +        }
  24887. +      break;
  24888. +
  24889. +    /* Indirect .sdata relocation */
  24890. +    case R_PPC_EMB_SDAI16:
  24891. +      if (info->shared)
  24892. +        {
  24893. +          ((*_bfd_error_handler)
  24894. +           (_("%s: relocation %s cannot be used when making a shared object"),
  24895. +        bfd_archive_filename (abfd), "R_PPC_EMB_SDAI16"));
  24896. +          return false;
  24897. +        }
  24898. +
  24899. +      if (srelgot == NULL && (h != NULL || info->shared))
  24900. +        {
  24901. +          srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  24902. +          if (srelgot == NULL)
  24903. +        {
  24904. +          srelgot = bfd_make_section (dynobj, ".rela.got");
  24905. +          if (srelgot == NULL
  24906. +              || ! bfd_set_section_flags (dynobj, srelgot,
  24907. +                          (SEC_ALLOC
  24908. +                           | SEC_LOAD
  24909. +                           | SEC_HAS_CONTENTS
  24910. +                           | SEC_IN_MEMORY
  24911. +                           | SEC_LINKER_CREATED
  24912. +                           | SEC_READONLY))
  24913. +              || ! bfd_set_section_alignment (dynobj, srelgot, 2))
  24914. +            return false;
  24915. +        }
  24916. +        }
  24917. +
  24918. +      if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata, h, rel))
  24919. +        return false;
  24920. +
  24921. +      break;
  24922. +
  24923. +    /* Indirect .sdata2 relocation */
  24924. +    case R_PPC_EMB_SDA2I16:
  24925. +      if (info->shared)
  24926. +        {
  24927. +          ((*_bfd_error_handler)
  24928. +           (_("%s: relocation %s cannot be used when making a shared object"),
  24929. +        bfd_archive_filename (abfd), "R_PPC_EMB_SDA2I16"));
  24930. +          return false;
  24931. +        }
  24932. +
  24933. +      if (srelgot == NULL && (h != NULL || info->shared))
  24934. +        {
  24935. +          srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  24936. +          if (srelgot == NULL)
  24937. +        {
  24938. +          srelgot = bfd_make_section (dynobj, ".rela.got");
  24939. +          if (srelgot == NULL
  24940. +              || ! bfd_set_section_flags (dynobj, srelgot,
  24941. +                          (SEC_ALLOC
  24942. +                           | SEC_LOAD
  24943. +                           | SEC_HAS_CONTENTS
  24944. +                           | SEC_IN_MEMORY
  24945. +                           | SEC_LINKER_CREATED
  24946. +                           | SEC_READONLY))
  24947. +              || ! bfd_set_section_alignment (dynobj, srelgot, 2))
  24948. +            return false;
  24949. +        }
  24950. +        }
  24951. +
  24952. +      if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata2, h, rel))
  24953. +        return false;
  24954. +
  24955. +      break;
  24956. +
  24957. +    case R_PPC_SDAREL16:
  24958. +    case R_PPC_EMB_SDA2REL:
  24959. +    case R_PPC_EMB_SDA21:
  24960. +      if (info->shared)
  24961. +        {
  24962. +          ((*_bfd_error_handler)
  24963. +           (_("%s: relocation %s cannot be used when making a shared object"),
  24964. +        bfd_archive_filename (abfd),
  24965. +        ppc_elf_howto_table[(int) ELF32_R_TYPE (rel->r_info)]->name));
  24966. +          return false;
  24967. +        }
  24968. +      break;
  24969. +
  24970. +    case R_PPC_PLT32:
  24971. +    case R_PPC_PLTREL24:
  24972. +    case R_PPC_PLT16_LO:
  24973. +    case R_PPC_PLT16_HI:
  24974. +    case R_PPC_PLT16_HA:
  24975. +#ifdef DEBUG
  24976. +      fprintf (stderr, "Reloc requires a PLT entry\n");
  24977. +#endif
  24978. +      /* This symbol requires a procedure linkage table entry.  We
  24979. +             actually build the entry in adjust_dynamic_symbol,
  24980. +             because this might be a case of linking PIC code without
  24981. +             linking in any dynamic objects, in which case we don't
  24982. +             need to generate a procedure linkage table after all.  */
  24983. +
  24984. +      if (h == NULL)
  24985. +        {
  24986. +          /* It does not make sense to have a procedure linkage
  24987. +                 table entry for a local symbol.  */
  24988. +          bfd_set_error (bfd_error_bad_value);
  24989. +          return false;
  24990. +        }
  24991. +
  24992. +      /* Make sure this symbol is output as a dynamic symbol.  */
  24993. +      if (h->dynindx == -1)
  24994. +        {
  24995. +          if (! bfd_elf32_link_record_dynamic_symbol (info, h))
  24996. +        return false;
  24997. +        }
  24998. +      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
  24999. +      h->plt.refcount++;
  25000. +      break;
  25001. +
  25002. +      /* The following relocations don't need to propagate the
  25003. +         relocation if linking a shared object since they are
  25004. +         section relative.  */
  25005. +    case R_PPC_SECTOFF:
  25006. +    case R_PPC_SECTOFF_LO:
  25007. +    case R_PPC_SECTOFF_HI:
  25008. +    case R_PPC_SECTOFF_HA:
  25009. +      break;
  25010. +
  25011. +      /* This refers only to functions defined in the shared library */
  25012. +    case R_PPC_LOCAL24PC:
  25013. +      break;
  25014. +
  25015. +      /* This relocation describes the C++ object vtable hierarchy.
  25016. +         Reconstruct it for later use during GC.  */
  25017. +    case R_PPC_GNU_VTINHERIT:
  25018. +      if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
  25019. +        return false;
  25020. +      break;
  25021. +
  25022. +      /* This relocation describes which C++ vtable entries are actually
  25023. +         used.  Record for later use during GC.  */
  25024. +    case R_PPC_GNU_VTENTRY:
  25025. +      if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
  25026. +        return false;
  25027. +      break;
  25028. +
  25029. +      /* When creating a shared object, we must copy these
  25030. +         relocs into the output file.  We create a reloc
  25031. +         section in dynobj and make room for the reloc.  */
  25032. +    case R_PPC_REL24:
  25033. +    case R_PPC_REL14:
  25034. +    case R_PPC_REL14_BRTAKEN:
  25035. +    case R_PPC_REL14_BRNTAKEN:
  25036. +    case R_PPC_REL32:
  25037. +      if (h == NULL
  25038. +          || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
  25039. +          || SYMBOL_REFERENCES_LOCAL (info, h))
  25040. +        break;
  25041. +      /* fall through */
  25042. +
  25043. +    default:
  25044. +      if (info->shared)
  25045. +        {
  25046. +#ifdef DEBUG
  25047. +          fprintf (stderr, "ppc_elf_check_relocs need to create relocation for %s\n",
  25048. +               (h && h->root.root.string) ? h->root.root.string : "<unknown>");
  25049. +#endif
  25050. +          if (sreloc == NULL)
  25051. +        {
  25052. +          const char *name;
  25053. +
  25054. +          name = (bfd_elf_string_from_elf_section
  25055. +              (abfd,
  25056. +               elf_elfheader (abfd)->e_shstrndx,
  25057. +               elf_section_data (sec)->rel_hdr.sh_name));
  25058. +          if (name == NULL)
  25059. +            return false;
  25060. +
  25061. +          BFD_ASSERT (strncmp (name, ".rela", 5) == 0
  25062. +                  && strcmp (bfd_get_section_name (abfd, sec),
  25063. +                     name + 5) == 0);
  25064. +
  25065. +          sreloc = bfd_get_section_by_name (dynobj, name);
  25066. +          if (sreloc == NULL)
  25067. +            {
  25068. +              flagword flags;
  25069. +
  25070. +              sreloc = bfd_make_section (dynobj, name);
  25071. +              flags = (SEC_HAS_CONTENTS | SEC_READONLY
  25072. +                   | SEC_IN_MEMORY | SEC_LINKER_CREATED);
  25073. +              if ((sec->flags & SEC_ALLOC) != 0)
  25074. +            flags |= SEC_ALLOC | SEC_LOAD;
  25075. +              if (sreloc == NULL
  25076. +              || ! bfd_set_section_flags (dynobj, sreloc, flags)
  25077. +              || ! bfd_set_section_alignment (dynobj, sreloc, 2))
  25078. +            return false;
  25079. +            }
  25080. +          if (sec->flags & SEC_READONLY)
  25081. +            info->flags |= DF_TEXTREL;
  25082. +        }
  25083. +
  25084. +          sreloc->_raw_size += sizeof (Elf32_External_Rela);
  25085. +
  25086. +          /* FIXME: We should here do what the m68k and i386
  25087. +         backends do: if the reloc is pc-relative, record it
  25088. +         in case it turns out that the reloc is unnecessary
  25089. +         because the symbol is forced local by versioning or
  25090. +         we are linking with -Bdynamic.  Fortunately this
  25091. +         case is not frequent.  */
  25092. +        }
  25093. +
  25094. +      break;
  25095. +    }
  25096. +    }
  25097. +
  25098. +  return true;
  25099. +}
  25100. +
  25101. +/* Return the section that should be marked against GC for a given
  25102. +   relocation.  */
  25103. +
  25104. +static asection *
  25105. +ppc_elf_gc_mark_hook (sec, info, rel, h, sym)
  25106. +     asection *sec;
  25107. +     struct bfd_link_info *info ATTRIBUTE_UNUSED;
  25108. +     Elf_Internal_Rela *rel;
  25109. +     struct elf_link_hash_entry *h;
  25110. +     Elf_Internal_Sym *sym;
  25111. +{
  25112. +  if (h != NULL)
  25113. +    {
  25114. +      switch (ELF32_R_TYPE (rel->r_info))
  25115. +    {
  25116. +    case R_PPC_GNU_VTINHERIT:
  25117. +    case R_PPC_GNU_VTENTRY:
  25118. +      break;
  25119. +
  25120. +    default:
  25121. +      switch (h->root.type)
  25122. +        {
  25123. +        case bfd_link_hash_defined:
  25124. +        case bfd_link_hash_defweak:
  25125. +          return h->root.u.def.section;
  25126. +
  25127. +        case bfd_link_hash_common:
  25128. +          return h->root.u.c.p->section;
  25129. +
  25130. +        default:
  25131. +          break;
  25132. +        }
  25133. +    }
  25134. +    }
  25135. +  else
  25136. +    return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
  25137. +
  25138. +  return NULL;
  25139. +}
  25140. +
  25141. +/* Update the got entry reference counts for the section being removed.  */
  25142. +
  25143. +static boolean
  25144. +ppc_elf_gc_sweep_hook (abfd, info, sec, relocs)
  25145. +     bfd *abfd;
  25146. +     struct bfd_link_info *info ATTRIBUTE_UNUSED;
  25147. +     asection *sec;
  25148. +     const Elf_Internal_Rela *relocs;
  25149. +{
  25150. +  Elf_Internal_Shdr *symtab_hdr;
  25151. +  struct elf_link_hash_entry **sym_hashes;
  25152. +  bfd_signed_vma *local_got_refcounts;
  25153. +  const Elf_Internal_Rela *rel, *relend;
  25154. +  unsigned long r_symndx;
  25155. +  struct elf_link_hash_entry *h;
  25156. +
  25157. +  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  25158. +  sym_hashes = elf_sym_hashes (abfd);
  25159. +  local_got_refcounts = elf_local_got_refcounts (abfd);
  25160. +
  25161. +  relend = relocs + sec->reloc_count;
  25162. +  for (rel = relocs; rel < relend; rel++)
  25163. +    switch (ELF32_R_TYPE (rel->r_info))
  25164. +      {
  25165. +      case R_PPC_GOT16:
  25166. +      case R_PPC_GOT16_LO:
  25167. +      case R_PPC_GOT16_HI:
  25168. +      case R_PPC_GOT16_HA:
  25169. +    r_symndx = ELF32_R_SYM (rel->r_info);
  25170. +    if (r_symndx >= symtab_hdr->sh_info)
  25171. +      {
  25172. +        h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  25173. +        if (h->got.refcount > 0)
  25174. +          h->got.refcount--;
  25175. +      }
  25176. +    else if (local_got_refcounts != NULL)
  25177. +      {
  25178. +        if (local_got_refcounts[r_symndx] > 0)
  25179. +          local_got_refcounts[r_symndx]--;
  25180. +      }
  25181. +        break;
  25182. +
  25183. +      case R_PPC_PLT32:
  25184. +      case R_PPC_PLTREL24:
  25185. +      case R_PPC_PLT16_LO:
  25186. +      case R_PPC_PLT16_HI:
  25187. +      case R_PPC_PLT16_HA:
  25188. +    r_symndx = ELF32_R_SYM (rel->r_info);
  25189. +    if (r_symndx >= symtab_hdr->sh_info)
  25190. +      {
  25191. +        h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  25192. +        if (h->plt.refcount > 0)
  25193. +          h->plt.refcount--;
  25194. +      }
  25195. +    break;
  25196. +
  25197. +      default:
  25198. +    break;
  25199. +      }
  25200. +
  25201. +  return true;
  25202. +}
  25203. +
  25204. +/* Hook called by the linker routine which adds symbols from an object
  25205. +   file.  We use it to put .comm items in .sbss, and not .bss.  */
  25206. +
  25207. +static boolean
  25208. +ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
  25209. +     bfd *abfd;
  25210. +     struct bfd_link_info *info;
  25211. +     const Elf_Internal_Sym *sym;
  25212. +     const char **namep ATTRIBUTE_UNUSED;
  25213. +     flagword *flagsp ATTRIBUTE_UNUSED;
  25214. +     asection **secp;
  25215. +     bfd_vma *valp;
  25216. +{
  25217. +  if (sym->st_shndx == SHN_COMMON
  25218. +      && !info->relocateable
  25219. +      && sym->st_size <= elf_gp_size (abfd)
  25220. +      && info->hash->creator->flavour == bfd_target_elf_flavour)
  25221. +    {
  25222. +      /* Common symbols less than or equal to -G nn bytes are automatically
  25223. +     put into .sdata.  */
  25224. +      elf_linker_section_t *sdata
  25225. +    = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA);
  25226. +
  25227. +      if (!sdata->bss_section)
  25228. +    {
  25229. +      bfd_size_type amt;
  25230. +
  25231. +      /* We don't go through bfd_make_section, because we don't
  25232. +             want to attach this common section to DYNOBJ.  The linker
  25233. +             will move the symbols to the appropriate output section
  25234. +             when it defines common symbols.  */
  25235. +      amt = sizeof (asection);
  25236. +      sdata->bss_section = (asection *) bfd_zalloc (abfd, amt);
  25237. +      if (sdata->bss_section == NULL)
  25238. +        return false;
  25239. +      sdata->bss_section->name = sdata->bss_name;
  25240. +      sdata->bss_section->flags = SEC_IS_COMMON;
  25241. +      sdata->bss_section->output_section = sdata->bss_section;
  25242. +      amt = sizeof (asymbol);
  25243. +      sdata->bss_section->symbol = (asymbol *) bfd_zalloc (abfd, amt);
  25244. +      amt = sizeof (asymbol *);
  25245. +      sdata->bss_section->symbol_ptr_ptr =
  25246. +        (asymbol **) bfd_zalloc (abfd, amt);
  25247. +      if (sdata->bss_section->symbol == NULL
  25248. +          || sdata->bss_section->symbol_ptr_ptr == NULL)
  25249. +        return false;
  25250. +      sdata->bss_section->symbol->name = sdata->bss_name;
  25251. +      sdata->bss_section->symbol->flags = BSF_SECTION_SYM;
  25252. +      sdata->bss_section->symbol->section = sdata->bss_section;
  25253. +      *sdata->bss_section->symbol_ptr_ptr = sdata->bss_section->symbol;
  25254. +    }
  25255. +
  25256. +      *secp = sdata->bss_section;
  25257. +      *valp = sym->st_size;
  25258. +    }
  25259. +
  25260. +  return true;
  25261. +}
  25262. +
  25263. +/* Finish up dynamic symbol handling.  We set the contents of various
  25264. +   dynamic sections here.  */
  25265. +
  25266. +static boolean
  25267. +ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
  25268. +     bfd *output_bfd;
  25269. +     struct bfd_link_info *info;
  25270. +     struct elf_link_hash_entry *h;
  25271. +     Elf_Internal_Sym *sym;
  25272. +{
  25273. +  bfd *dynobj;
  25274. +
  25275. +#ifdef DEBUG
  25276. +  fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s",
  25277. +       h->root.root.string);
  25278. +#endif
  25279. +
  25280. +  dynobj = elf_hash_table (info)->dynobj;
  25281. +  BFD_ASSERT (dynobj != NULL);
  25282. +
  25283. +  if (h->plt.offset != (bfd_vma) -1)
  25284. +    {
  25285. +      asection *splt;
  25286. +      asection *srela;
  25287. +      Elf_Internal_Rela rela;
  25288. +      bfd_vma reloc_index;
  25289. +
  25290. +#ifdef DEBUG
  25291. +      fprintf (stderr, ", plt_offset = %d", h->plt.offset);
  25292. +#endif
  25293. +
  25294. +      /* This symbol has an entry in the procedure linkage table.  Set
  25295. +         it up.  */
  25296. +
  25297. +      BFD_ASSERT (h->dynindx != -1);
  25298. +
  25299. +      splt = bfd_get_section_by_name (dynobj, ".plt");
  25300. +      srela = bfd_get_section_by_name (dynobj, ".rela.plt");
  25301. +      BFD_ASSERT (splt != NULL && srela != NULL);
  25302. +
  25303. +      /* We don't need to fill in the .plt.  The ppc dynamic linker
  25304. +     will fill it in.  */
  25305. +
  25306. +      /* Fill in the entry in the .rela.plt section.  */
  25307. +      rela.r_offset = (splt->output_section->vma
  25308. +               + splt->output_offset
  25309. +               + h->plt.offset);
  25310. +      rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT);
  25311. +      rela.r_addend = 0;
  25312. +
  25313. +      reloc_index = (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_SLOT_SIZE;
  25314. +      if (reloc_index > PLT_NUM_SINGLE_ENTRIES)
  25315. +    reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2;
  25316. +      bfd_elf32_swap_reloca_out (output_bfd, &rela,
  25317. +                 ((Elf32_External_Rela *) srela->contents
  25318. +                  + reloc_index));
  25319. +
  25320. +      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
  25321. +    {
  25322. +      /* Mark the symbol as undefined, rather than as defined in
  25323. +         the .plt section.  Leave the value alone.  */
  25324. +      sym->st_shndx = SHN_UNDEF;
  25325. +      /* If the symbol is weak, we do need to clear the value.
  25326. +         Otherwise, the PLT entry would provide a definition for
  25327. +         the symbol even if the symbol wasn't defined anywhere,
  25328. +         and so the symbol would never be NULL.  */
  25329. +      if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
  25330. +          == 0)
  25331. +        sym->st_value = 0;
  25332. +    }
  25333. +    }
  25334. +
  25335. +  if (h->got.offset != (bfd_vma) -1)
  25336. +    {
  25337. +      asection *sgot;
  25338. +      asection *srela;
  25339. +      Elf_Internal_Rela rela;
  25340. +
  25341. +      /* This symbol has an entry in the global offset table.  Set it
  25342. +         up.  */
  25343. +
  25344. +      sgot = bfd_get_section_by_name (dynobj, ".got");
  25345. +      srela = bfd_get_section_by_name (dynobj, ".rela.got");
  25346. +      BFD_ASSERT (sgot != NULL && srela != NULL);
  25347. +
  25348. +      rela.r_offset = (sgot->output_section->vma
  25349. +               + sgot->output_offset
  25350. +               + (h->got.offset &~ (bfd_vma) 1));
  25351. +
  25352. +      /* If this is a -Bsymbolic link, and the symbol is defined
  25353. +     locally, we just want to emit a RELATIVE reloc.  The entry in
  25354. +     the global offset table will already have been initialized in
  25355. +     the relocate_section function.  */
  25356. +      if (info->shared
  25357. +      && SYMBOL_REFERENCES_LOCAL (info, h))
  25358. +    {
  25359. +      rela.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
  25360. +      rela.r_addend = (h->root.u.def.value
  25361. +               + h->root.u.def.section->output_section->vma
  25362. +               + h->root.u.def.section->output_offset);
  25363. +    }
  25364. +      else
  25365. +    {
  25366. +      BFD_ASSERT ((h->got.offset & 1) == 0);
  25367. +      rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT);
  25368. +      rela.r_addend = 0;
  25369. +    }
  25370. +
  25371. +      bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
  25372. +      bfd_elf32_swap_reloca_out (output_bfd, &rela,
  25373. +                 ((Elf32_External_Rela *) srela->contents
  25374. +                  + srela->reloc_count));
  25375. +      ++srela->reloc_count;
  25376. +    }
  25377. +
  25378. +  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
  25379. +    {
  25380. +      asection *s;
  25381. +      Elf_Internal_Rela rela;
  25382. +
  25383. +      /* This symbols needs a copy reloc.  Set it up.  */
  25384. +
  25385. +#ifdef DEBUG
  25386. +      fprintf (stderr, ", copy");
  25387. +#endif
  25388. +
  25389. +      BFD_ASSERT (h->dynindx != -1);
  25390. +
  25391. +      if (h->size <= elf_gp_size (dynobj))
  25392. +    s = bfd_get_section_by_name (h->root.u.def.section->owner,
  25393. +                     ".rela.sbss");
  25394. +      else
  25395. +    s = bfd_get_section_by_name (h->root.u.def.section->owner,
  25396. +                     ".rela.bss");
  25397. +      BFD_ASSERT (s != NULL);
  25398. +
  25399. +      rela.r_offset = (h->root.u.def.value
  25400. +               + h->root.u.def.section->output_section->vma
  25401. +               + h->root.u.def.section->output_offset);
  25402. +      rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY);
  25403. +      rela.r_addend = 0;
  25404. +      bfd_elf32_swap_reloca_out (output_bfd, &rela,
  25405. +                 ((Elf32_External_Rela *) s->contents
  25406. +                  + s->reloc_count));
  25407. +      ++s->reloc_count;
  25408. +    }
  25409. +
  25410. +#ifdef DEBUG
  25411. +  fprintf (stderr, "\n");
  25412. +#endif
  25413. +
  25414. +  /* Mark some specially defined symbols as absolute.  */
  25415. +  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
  25416. +      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
  25417. +      || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
  25418. +    sym->st_shndx = SHN_ABS;
  25419. +
  25420. +  return true;
  25421. +}
  25422. +
  25423. +/* Finish up the dynamic sections.  */
  25424. +
  25425. +static boolean
  25426. +ppc_elf_finish_dynamic_sections (output_bfd, info)
  25427. +     bfd *output_bfd;
  25428. +     struct bfd_link_info *info;
  25429. +{
  25430. +  asection *sdyn;
  25431. +  bfd *dynobj = elf_hash_table (info)->dynobj;
  25432. +  asection *sgot = bfd_get_section_by_name (dynobj, ".got");
  25433. +
  25434. +#ifdef DEBUG
  25435. +  fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
  25436. +#endif
  25437. +
  25438. +  sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
  25439. +
  25440. +  if (elf_hash_table (info)->dynamic_sections_created)
  25441. +    {
  25442. +      asection *splt;
  25443. +      Elf32_External_Dyn *dyncon, *dynconend;
  25444. +
  25445. +      splt = bfd_get_section_by_name (dynobj, ".plt");
  25446. +      BFD_ASSERT (splt != NULL && sdyn != NULL);
  25447. +
  25448. +      dyncon = (Elf32_External_Dyn *) sdyn->contents;
  25449. +      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
  25450. +      for (; dyncon < dynconend; dyncon++)
  25451. +    {
  25452. +      Elf_Internal_Dyn dyn;
  25453. +      const char *name;
  25454. +      boolean size;
  25455. +
  25456. +      bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
  25457. +
  25458. +      switch (dyn.d_tag)
  25459. +        {
  25460. +        case DT_PLTGOT:   name = ".plt";      size = false; break;
  25461. +        case DT_PLTRELSZ: name = ".rela.plt"; size = true;  break;
  25462. +        case DT_JMPREL:   name = ".rela.plt"; size = false; break;
  25463. +        default:          name = NULL;      size = false; break;
  25464. +        }
  25465. +
  25466. +      if (name != NULL)
  25467. +        {
  25468. +          asection *s;
  25469. +
  25470. +          s = bfd_get_section_by_name (output_bfd, name);
  25471. +          if (s == NULL)
  25472. +        dyn.d_un.d_val = 0;
  25473. +          else
  25474. +        {
  25475. +          if (! size)
  25476. +            dyn.d_un.d_ptr = s->vma;
  25477. +          else
  25478. +            {
  25479. +              if (s->_cooked_size != 0)
  25480. +            dyn.d_un.d_val = s->_cooked_size;
  25481. +              else
  25482. +            dyn.d_un.d_val = s->_raw_size;
  25483. +            }
  25484. +        }
  25485. +          bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
  25486. +        }
  25487. +    }
  25488. +    }
  25489. +
  25490. +  /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
  25491. +     easily find the address of the _GLOBAL_OFFSET_TABLE_.  */
  25492. +  if (sgot)
  25493. +    {
  25494. +      unsigned char *contents = sgot->contents;
  25495. +      bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents);
  25496. +
  25497. +      if (sdyn == NULL)
  25498. +    bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
  25499. +      else
  25500. +    bfd_put_32 (output_bfd,
  25501. +            sdyn->output_section->vma + sdyn->output_offset,
  25502. +            contents+4);
  25503. +
  25504. +      elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
  25505. +    }
  25506. +
  25507. +  return true;
  25508. +}
  25509. +
  25510. +/* The RELOCATE_SECTION function is called by the ELF backend linker
  25511. +   to handle the relocations for a section.
  25512. +
  25513. +   The relocs are always passed as Rela structures; if the section
  25514. +   actually uses Rel structures, the r_addend field will always be
  25515. +   zero.
  25516. +
  25517. +   This function is responsible for adjust the section contents as
  25518. +   necessary, and (if using Rela relocs and generating a
  25519. +   relocateable output file) adjusting the reloc addend as
  25520. +   necessary.
  25521. +
  25522. +   This function does not have to worry about setting the reloc
  25523. +   address or the reloc symbol index.
  25524. +
  25525. +   LOCAL_SYMS is a pointer to the swapped in local symbols.
  25526. +
  25527. +   LOCAL_SECTIONS is an array giving the section in the input file
  25528. +   corresponding to the st_shndx field of each local symbol.
  25529. +
  25530. +   The global hash table entry for the global symbols can be found
  25531. +   via elf_sym_hashes (input_bfd).
  25532. +
  25533. +   When generating relocateable output, this function must handle
  25534. +   STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
  25535. +   going to be the section symbol corresponding to the output
  25536. +   section, which means that the addend must be adjusted
  25537. +   accordingly.  */
  25538. +
  25539. +static boolean
  25540. +ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
  25541. +              contents, relocs, local_syms, local_sections)
  25542. +     bfd *output_bfd;
  25543. +     struct bfd_link_info *info;
  25544. +     bfd *input_bfd;
  25545. +     asection *input_section;
  25546. +     bfd_byte *contents;
  25547. +     Elf_Internal_Rela *relocs;
  25548. +     Elf_Internal_Sym *local_syms;
  25549. +     asection **local_sections;
  25550. +{
  25551. +  Elf_Internal_Shdr *symtab_hdr          = &elf_tdata (input_bfd)->symtab_hdr;
  25552. +  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
  25553. +  bfd *dynobj                  = elf_hash_table (info)->dynobj;
  25554. +  elf_linker_section_t *sdata          = (dynobj) ? elf_linker_section (dynobj, LINKER_SECTION_SDATA)  : NULL;
  25555. +  elf_linker_section_t *sdata2          = (dynobj) ? elf_linker_section (dynobj, LINKER_SECTION_SDATA2) : NULL;
  25556. +  Elf_Internal_Rela *rel          = relocs;
  25557. +  Elf_Internal_Rela *relend          = relocs + input_section->reloc_count;
  25558. +  asection *sreloc              = NULL;
  25559. +  asection *splt;
  25560. +  asection *sgot;
  25561. +  bfd_vma *local_got_offsets;
  25562. +  boolean ret                  = true;
  25563. +  long insn;
  25564. +
  25565. +#ifdef DEBUG
  25566. +  fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n",
  25567. +       bfd_archive_filename (input_bfd),
  25568. +       bfd_section_name(input_bfd, input_section),
  25569. +       (long) input_section->reloc_count,
  25570. +       (info->relocateable) ? " (relocatable)" : "");
  25571. +#endif
  25572. +
  25573. +  if (info->relocateable)
  25574. +    return true;
  25575. +
  25576. +  if (!ppc_elf_howto_table[R_PPC_ADDR32])
  25577. +    /* Initialize howto table if needed.  */
  25578. +    ppc_elf_howto_init ();
  25579. +
  25580. +  local_got_offsets = elf_local_got_offsets (input_bfd);
  25581. +
  25582. +  splt = sgot = NULL;
  25583. +  if (dynobj != NULL)
  25584. +    {
  25585. +      splt = bfd_get_section_by_name (dynobj, ".plt");
  25586. +      sgot = bfd_get_section_by_name (dynobj, ".got");
  25587. +    }
  25588. +
  25589. +  for (; rel < relend; rel++)
  25590. +    {
  25591. +      enum elf_ppc_reloc_type r_type    = (enum elf_ppc_reloc_type)ELF32_R_TYPE (rel->r_info);
  25592. +      bfd_vma offset            = rel->r_offset;
  25593. +      bfd_vma addend            = rel->r_addend;
  25594. +      bfd_reloc_status_type r        = bfd_reloc_other;
  25595. +      Elf_Internal_Sym *sym        = (Elf_Internal_Sym *) 0;
  25596. +      asection *sec            = (asection *) 0;
  25597. +      struct elf_link_hash_entry *h    = (struct elf_link_hash_entry *) 0;
  25598. +      const char *sym_name        = (const char *) 0;
  25599. +      reloc_howto_type *howto;
  25600. +      unsigned long r_symndx;
  25601. +      bfd_vma relocation;
  25602. +      int will_become_local;
  25603. +
  25604. +      /* Unknown relocation handling */
  25605. +      if ((unsigned) r_type >= (unsigned) R_PPC_max
  25606. +      || !ppc_elf_howto_table[(int) r_type])
  25607. +    {
  25608. +      (*_bfd_error_handler) (_("%s: unknown relocation type %d"),
  25609. +                 bfd_archive_filename (input_bfd),
  25610. +                 (int) r_type);
  25611. +
  25612. +      bfd_set_error (bfd_error_bad_value);
  25613. +      ret = false;
  25614. +      continue;
  25615. +    }
  25616. +
  25617. +      howto = ppc_elf_howto_table[(int) r_type];
  25618. +      r_symndx = ELF32_R_SYM (rel->r_info);
  25619. +
  25620. +      if (r_symndx < symtab_hdr->sh_info)
  25621. +    {
  25622. +      sym = local_syms + r_symndx;
  25623. +      sec = local_sections[r_symndx];
  25624. +      sym_name = "<local symbol>";
  25625. +
  25626. +      relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
  25627. +      addend = rel->r_addend;
  25628. +      /* Relocs to local symbols are always resolved.  */
  25629. +      will_become_local = 1;
  25630. +    }
  25631. +      else
  25632. +    {
  25633. +      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  25634. +      while (h->root.type == bfd_link_hash_indirect
  25635. +         || h->root.type == bfd_link_hash_warning)
  25636. +        h = (struct elf_link_hash_entry *) h->root.u.i.link;
  25637. +      sym_name = h->root.root.string;
  25638. +
  25639. +      /* Can this relocation be resolved immediately?  */
  25640. +      will_become_local = SYMBOL_REFERENCES_LOCAL (info, h);
  25641. +
  25642. +      if (h->root.type == bfd_link_hash_defined
  25643. +          || h->root.type == bfd_link_hash_defweak)
  25644. +        {
  25645. +          sec = h->root.u.def.section;
  25646. +          if (((r_type == R_PPC_PLT32
  25647. +            || r_type == R_PPC_PLTREL24)
  25648. +           && splt != NULL
  25649. +           && h->plt.offset != (bfd_vma) -1)
  25650. +          || (r_type == R_PPC_LOCAL24PC
  25651. +              && sec->output_section == NULL)
  25652. +          || ((r_type == R_PPC_GOT16
  25653. +               || r_type == R_PPC_GOT16_LO
  25654. +               || r_type == R_PPC_GOT16_HI
  25655. +               || r_type == R_PPC_GOT16_HA)
  25656. +              && elf_hash_table (info)->dynamic_sections_created
  25657. +              && (! info->shared || ! will_become_local))
  25658. +          || (info->shared
  25659. +               && ! will_become_local
  25660. +              && ((input_section->flags & SEC_ALLOC) != 0
  25661. +              /* Testing SEC_DEBUGGING here may be wrong.
  25662. +                             It's here to avoid a crash when
  25663. +                             generating a shared library with DWARF
  25664. +                             debugging information.  */
  25665. +              || ((input_section->flags & SEC_DEBUGGING) != 0
  25666. +                  && (h->elf_link_hash_flags
  25667. +                  & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
  25668. +              && (r_type == R_PPC_ADDR32
  25669. +              || r_type == R_PPC_ADDR24
  25670. +              || r_type == R_PPC_ADDR16
  25671. +              || r_type == R_PPC_ADDR16_LO
  25672. +              || r_type == R_PPC_ADDR16_HI
  25673. +              || r_type == R_PPC_ADDR16_HA
  25674. +              || r_type == R_PPC_ADDR14
  25675. +              || r_type == R_PPC_ADDR14_BRTAKEN
  25676. +              || r_type == R_PPC_ADDR14_BRNTAKEN
  25677. +              || r_type == R_PPC_COPY
  25678. +              || r_type == R_PPC_GLOB_DAT
  25679. +              || r_type == R_PPC_JMP_SLOT
  25680. +              || r_type == R_PPC_UADDR32
  25681. +              || r_type == R_PPC_UADDR16
  25682. +              || r_type == R_PPC_SDAREL16
  25683. +              || r_type == R_PPC_EMB_NADDR32
  25684. +              || r_type == R_PPC_EMB_NADDR16
  25685. +              || r_type == R_PPC_EMB_NADDR16_LO
  25686. +              || r_type == R_PPC_EMB_NADDR16_HI
  25687. +              || r_type == R_PPC_EMB_NADDR16_HA
  25688. +              || r_type == R_PPC_EMB_SDAI16
  25689. +              || r_type == R_PPC_EMB_SDA2I16
  25690. +              || r_type == R_PPC_EMB_SDA2REL
  25691. +              || r_type == R_PPC_EMB_SDA21
  25692. +              || r_type == R_PPC_EMB_MRKREF
  25693. +              || r_type == R_PPC_EMB_BIT_FLD
  25694. +              || r_type == R_PPC_EMB_RELSDA
  25695. +              || ((r_type == R_PPC_REL24
  25696. +                   || r_type == R_PPC_REL32
  25697. +                   || r_type == R_PPC_REL14
  25698. +                   || r_type == R_PPC_REL14_BRTAKEN
  25699. +                   || r_type == R_PPC_REL14_BRNTAKEN
  25700. +                   || r_type == R_PPC_RELATIVE)
  25701. +                  && strcmp (h->root.root.string,
  25702. +                     "_GLOBAL_OFFSET_TABLE_") != 0))))
  25703. +        {
  25704. +          /* In these cases, we don't need the relocation
  25705. +                     value.  We check specially because in some
  25706. +                     obscure cases sec->output_section will be NULL.  */
  25707. +          relocation = 0;
  25708. +        }
  25709. +          else if (sec->output_section == NULL)
  25710. +        {
  25711. +                  (*_bfd_error_handler)
  25712. +                    (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
  25713. +                     bfd_archive_filename (input_bfd), h->root.root.string,
  25714. +                     bfd_get_section_name (input_bfd, input_section));
  25715. +          relocation = 0;
  25716. +        }
  25717. +          else
  25718. +        relocation = (h->root.u.def.value
  25719. +                  + sec->output_section->vma
  25720. +                  + sec->output_offset);
  25721. +        }
  25722. +      else if (h->root.type == bfd_link_hash_undefweak)
  25723. +        relocation = 0;
  25724. +      else if (info->shared
  25725. +           && (!info->symbolic || info->allow_shlib_undefined)
  25726. +           && !info->no_undefined
  25727. +           && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
  25728. +        relocation = 0;
  25729. +      else
  25730. +        {
  25731. +          if (! (*info->callbacks->undefined_symbol) (info,
  25732. +                             h->root.root.string,
  25733. +                             input_bfd,
  25734. +                             input_section,
  25735. +                             rel->r_offset,
  25736. +                             (!info->shared
  25737. +                              || info->no_undefined
  25738. +                              || ELF_ST_VISIBILITY (h->other))))
  25739. +        return false;
  25740. +          relocation = 0;
  25741. +        }
  25742. +    }
  25743. +
  25744. +      switch ((int) r_type)
  25745. +    {
  25746. +    default:
  25747. +      (*_bfd_error_handler) (_("%s: unknown relocation type %d for symbol %s"),
  25748. +                 bfd_archive_filename (input_bfd),
  25749. +                 (int) r_type, sym_name);
  25750. +
  25751. +      bfd_set_error (bfd_error_bad_value);
  25752. +      ret = false;
  25753. +      continue;
  25754. +
  25755. +    case (int) R_PPC_NONE:
  25756. +      continue;
  25757. +
  25758. +    /* Relocations that need no special processing.  */
  25759. +    case (int) R_PPC_LOCAL24PC:
  25760. +      /* It makes no sense to point a local relocation
  25761. +         at a symbol not in this object.  */
  25762. +      if (h != NULL
  25763. +          && (h->root.type == bfd_link_hash_defined
  25764. +          || h->root.type == bfd_link_hash_defweak)
  25765. +          && sec->output_section == NULL)
  25766. +        {
  25767. +          if (! (*info->callbacks->undefined_symbol) (info,
  25768. +                              h->root.root.string,
  25769. +                              input_bfd,
  25770. +                              input_section,
  25771. +                              rel->r_offset,
  25772. +                              true))
  25773. +        return false;
  25774. +          continue;
  25775. +        }
  25776. +      break;
  25777. +
  25778. +    /* Relocations that may need to be propagated if this is a shared
  25779. +           object.  */
  25780. +    case (int) R_PPC_REL24:
  25781. +    case (int) R_PPC_REL32:
  25782. +    case (int) R_PPC_REL14:
  25783. +      /* If these relocations are not to a named symbol, they can be
  25784. +         handled right here, no need to bother the dynamic linker.  */
  25785. +      if (h == NULL
  25786. +          || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
  25787. +          || SYMBOL_REFERENCES_LOCAL (info, h))
  25788. +        break;
  25789. +    /* fall through */
  25790. +
  25791. +    /* Relocations that always need to be propagated if this is a shared
  25792. +           object.  */
  25793. +    case (int) R_PPC_ADDR32:
  25794. +    case (int) R_PPC_ADDR24:
  25795. +    case (int) R_PPC_ADDR16:
  25796. +    case (int) R_PPC_ADDR16_LO:
  25797. +    case (int) R_PPC_ADDR16_HI:
  25798. +    case (int) R_PPC_ADDR16_HA:
  25799. +    case (int) R_PPC_ADDR14:
  25800. +    case (int) R_PPC_UADDR32:
  25801. +    case (int) R_PPC_UADDR16:
  25802. +      if (info->shared && r_symndx != 0)
  25803. +        {
  25804. +          Elf_Internal_Rela outrel;
  25805. +          int skip;
  25806. +
  25807. +#ifdef DEBUG
  25808. +          fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n",
  25809. +               (h && h->root.root.string) ? h->root.root.string : "<unknown>");
  25810. +#endif
  25811. +
  25812. +          /* When generating a shared object, these relocations
  25813. +                 are copied into the output file to be resolved at run
  25814. +                 time.  */
  25815. +
  25816. +          if (sreloc == NULL)
  25817. +        {
  25818. +          const char *name;
  25819. +
  25820. +          name = (bfd_elf_string_from_elf_section
  25821. +              (input_bfd,
  25822. +               elf_elfheader (input_bfd)->e_shstrndx,
  25823. +               elf_section_data (input_section)->rel_hdr.sh_name));
  25824. +          if (name == NULL)
  25825. +            return false;
  25826. +
  25827. +          BFD_ASSERT (strncmp (name, ".rela", 5) == 0
  25828. +                  && strcmp (bfd_get_section_name (input_bfd,
  25829. +                                   input_section),
  25830. +                     name + 5) == 0);
  25831. +
  25832. +          sreloc = bfd_get_section_by_name (dynobj, name);
  25833. +          BFD_ASSERT (sreloc != NULL);
  25834. +        }
  25835. +
  25836. +          skip = 0;
  25837. +
  25838. +          outrel.r_offset =
  25839. +        _bfd_elf_section_offset (output_bfd, info, input_section,
  25840. +                     rel->r_offset);
  25841. +          if (outrel.r_offset == (bfd_vma) -1
  25842. +          || outrel.r_offset == (bfd_vma) -2)
  25843. +        skip = (int) outrel.r_offset;
  25844. +          outrel.r_offset += (input_section->output_section->vma
  25845. +                  + input_section->output_offset);
  25846. +
  25847. +          if (skip)
  25848. +        memset (&outrel, 0, sizeof outrel);
  25849. +          /* h->dynindx may be -1 if this symbol was marked to
  25850. +                 become local.  */
  25851. +          else if (! will_become_local)
  25852. +        {
  25853. +          outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
  25854. +          outrel.r_addend = rel->r_addend;
  25855. +        }
  25856. +          else
  25857. +        {
  25858. +          if (r_type == R_PPC_ADDR32)
  25859. +            {
  25860. +              outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
  25861. +              outrel.r_addend = relocation + rel->r_addend;
  25862. +            }
  25863. +          else
  25864. +            {
  25865. +              long indx;
  25866. +
  25867. +              if (h == NULL)
  25868. +            sec = local_sections[r_symndx];
  25869. +              else
  25870. +            {
  25871. +              BFD_ASSERT (h->root.type == bfd_link_hash_defined
  25872. +                      || (h->root.type
  25873. +                      == bfd_link_hash_defweak));
  25874. +              sec = h->root.u.def.section;
  25875. +            }
  25876. +              if (sec != NULL && bfd_is_abs_section (sec))
  25877. +            indx = 0;
  25878. +              else if (sec == NULL || sec->owner == NULL)
  25879. +            {
  25880. +              bfd_set_error (bfd_error_bad_value);
  25881. +              return false;
  25882. +            }
  25883. +              else
  25884. +            {
  25885. +              asection *osec;
  25886. +
  25887. +              osec = sec->output_section;
  25888. +              indx = elf_section_data (osec)->dynindx;
  25889. +              BFD_ASSERT (indx > 0);
  25890. +#ifdef DEBUG
  25891. +              if (indx <= 0)
  25892. +                {
  25893. +                  printf ("indx=%d section=%s flags=%08x name=%s\n",
  25894. +                     indx, osec->name, osec->flags,
  25895. +                     h->root.root.string);
  25896. +                }
  25897. +#endif
  25898. +            }
  25899. +
  25900. +              outrel.r_info = ELF32_R_INFO (indx, r_type);
  25901. +              outrel.r_addend = relocation + rel->r_addend;
  25902. +            }
  25903. +        }
  25904. +
  25905. +          bfd_elf32_swap_reloca_out (output_bfd, &outrel,
  25906. +                     (((Elf32_External_Rela *)
  25907. +                       sreloc->contents)
  25908. +                      + sreloc->reloc_count));
  25909. +          ++sreloc->reloc_count;
  25910. +
  25911. +          if (skip == -1)
  25912. +        continue;
  25913. +
  25914. +          /* This reloc will be computed at runtime.  We clear the memory
  25915. +         so that it contains predictable value.  */
  25916. +          if (! skip
  25917. +          && ((input_section->flags & SEC_ALLOC) != 0
  25918. +              || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE))
  25919. +        {
  25920. +          relocation = howto->pc_relative ? outrel.r_offset : 0;
  25921. +          addend = 0;
  25922. +          break;
  25923. +        }
  25924. +        }
  25925. +
  25926. +      /* Arithmetic adjust relocations that aren't going into a
  25927. +         shared object.  */
  25928. +      if (r_type == R_PPC_ADDR16_HA
  25929. +          /* It's just possible that this symbol is a weak symbol
  25930. +         that's not actually defined anywhere. In that case,
  25931. +         'sec' would be NULL, and we should leave the symbol
  25932. +         alone (it will be set to zero elsewhere in the link).  */
  25933. +          && sec != NULL)
  25934. +        {
  25935. +          addend += ((relocation + addend) & 0x8000) << 1;
  25936. +        }
  25937. +      break;
  25938. +
  25939. +    /* branch taken prediction relocations */
  25940. +    case (int) R_PPC_ADDR14_BRTAKEN:
  25941. +    case (int) R_PPC_REL14_BRTAKEN:
  25942. +      insn = bfd_get_32 (output_bfd, contents + offset);
  25943. +      if ((relocation - offset) & 0x8000)
  25944. +        insn &= ~BRANCH_PREDICT_BIT;
  25945. +      else
  25946. +        insn |= BRANCH_PREDICT_BIT;
  25947. +      bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
  25948. +      break;
  25949. +
  25950. +    /* branch not taken predicition relocations */
  25951. +    case (int) R_PPC_ADDR14_BRNTAKEN:
  25952. +    case (int) R_PPC_REL14_BRNTAKEN:
  25953. +      insn = bfd_get_32 (output_bfd, contents + offset);
  25954. +      if ((relocation - offset) & 0x8000)
  25955. +        insn |= BRANCH_PREDICT_BIT;
  25956. +      else
  25957. +        insn &= ~BRANCH_PREDICT_BIT;
  25958. +      bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
  25959. +      break;
  25960. +
  25961. +    /* GOT16 relocations */
  25962. +    case (int) R_PPC_GOT16:
  25963. +    case (int) R_PPC_GOT16_LO:
  25964. +    case (int) R_PPC_GOT16_HI:
  25965. +    case (int) R_PPC_GOT16_HA:
  25966. +      /* Relocation is to the entry for this symbol in the global
  25967. +             offset table.  */
  25968. +      BFD_ASSERT (sgot != NULL);
  25969. +
  25970. +      if (h != NULL)
  25971. +        {
  25972. +          bfd_vma off;
  25973. +
  25974. +          off = h->got.offset;
  25975. +          BFD_ASSERT (off != (bfd_vma) -1);
  25976. +
  25977. +          if (! elf_hash_table (info)->dynamic_sections_created
  25978. +          || (info->shared
  25979. +              && SYMBOL_REFERENCES_LOCAL (info, h)))
  25980. +        {
  25981. +          /* This is actually a static link, or it is a
  25982. +                     -Bsymbolic link and the symbol is defined
  25983. +                     locally.  We must initialize this entry in the
  25984. +                     global offset table.  Since the offset must
  25985. +                     always be a multiple of 4, we use the least
  25986. +                     significant bit to record whether we have
  25987. +                     initialized it already.
  25988. +
  25989. +             When doing a dynamic link, we create a .rela.got
  25990. +             relocation entry to initialize the value.  This
  25991. +             is done in the finish_dynamic_symbol routine.  */
  25992. +          if ((off & 1) != 0)
  25993. +            off &= ~1;
  25994. +          else
  25995. +            {
  25996. +              bfd_put_32 (output_bfd, relocation,
  25997. +                  sgot->contents + off);
  25998. +              h->got.offset |= 1;
  25999. +            }
  26000. +        }
  26001. +
  26002. +          relocation = sgot->output_offset + off - 4;
  26003. +        }
  26004. +      else
  26005. +        {
  26006. +          bfd_vma off;
  26007. +
  26008. +          BFD_ASSERT (local_got_offsets != NULL
  26009. +              && local_got_offsets[r_symndx] != (bfd_vma) -1);
  26010. +
  26011. +          off = local_got_offsets[r_symndx];
  26012. +
  26013. +          /* The offset must always be a multiple of 4.  We use
  26014. +         the least significant bit to record whether we have
  26015. +         already processed this entry.  */
  26016. +          if ((off & 1) != 0)
  26017. +        off &= ~1;
  26018. +          else
  26019. +        {
  26020. +
  26021. +          if (info->shared)
  26022. +            {
  26023. +              asection *srelgot;
  26024. +              Elf_Internal_Rela outrel;
  26025. +
  26026. +              /* We need to generate a R_PPC_RELATIVE reloc
  26027. +             for the dynamic linker.  */
  26028. +              srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  26029. +              BFD_ASSERT (srelgot != NULL);
  26030. +
  26031. +              outrel.r_offset = (sgot->output_section->vma
  26032. +                     + sgot->output_offset
  26033. +                     + off);
  26034. +              outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
  26035. +              outrel.r_addend = relocation;
  26036. +              bfd_elf32_swap_reloca_out (output_bfd, &outrel,
  26037. +                         (((Elf32_External_Rela *)
  26038. +                           srelgot->contents)
  26039. +                          + srelgot->reloc_count));
  26040. +              ++srelgot->reloc_count;
  26041. +              relocation = 0;
  26042. +            }
  26043. +
  26044. +          bfd_put_32 (output_bfd, relocation, sgot->contents + off);
  26045. +          local_got_offsets[r_symndx] |= 1;
  26046. +        }
  26047. +
  26048. +          relocation = sgot->output_offset + off - 4;
  26049. +        }
  26050. +      break;
  26051. +
  26052. +    /* Indirect .sdata relocation */
  26053. +    case (int) R_PPC_EMB_SDAI16:
  26054. +      BFD_ASSERT (sdata != NULL);
  26055. +      relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
  26056. +                                sdata, h, relocation, rel,
  26057. +                                R_PPC_RELATIVE);
  26058. +      break;
  26059. +
  26060. +    /* Indirect .sdata2 relocation */
  26061. +    case (int) R_PPC_EMB_SDA2I16:
  26062. +      BFD_ASSERT (sdata2 != NULL);
  26063. +      relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
  26064. +                                sdata2, h, relocation, rel,
  26065. +                                R_PPC_RELATIVE);
  26066. +      break;
  26067. +
  26068. +    /* Handle the TOC16 reloc.  We want to use the offset within the .got
  26069. +       section, not the actual VMA.  This is appropriate when generating
  26070. +       an embedded ELF object, for which the .got section acts like the
  26071. +       AIX .toc section.  */
  26072. +    case (int) R_PPC_TOC16:            /* phony GOT16 relocations */
  26073. +      BFD_ASSERT (sec != (asection *) 0);
  26074. +      BFD_ASSERT (bfd_is_und_section (sec)
  26075. +              || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
  26076. +              || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0)
  26077. +
  26078. +      addend -= sec->output_section->vma + sec->output_offset + 0x8000;
  26079. +      break;
  26080. +
  26081. +    case (int) R_PPC_PLTREL24:
  26082. +      /* Relocation is to the entry for this symbol in the
  26083. +             procedure linkage table.  */
  26084. +      BFD_ASSERT (h != NULL);
  26085. +
  26086. +      if (h->plt.offset == (bfd_vma) -1
  26087. +          || splt == NULL)
  26088. +        {
  26089. +          /* We didn't make a PLT entry for this symbol.  This
  26090. +                 happens when statically linking PIC code, or when
  26091. +                 using -Bsymbolic.  */
  26092. +          break;
  26093. +        }
  26094. +
  26095. +      relocation = (splt->output_section->vma
  26096. +            + splt->output_offset
  26097. +            + h->plt.offset);
  26098. +      break;
  26099. +
  26100. +    /* relocate against _SDA_BASE_ */
  26101. +    case (int) R_PPC_SDAREL16:
  26102. +      {
  26103. +        const char *name;
  26104. +
  26105. +        BFD_ASSERT (sec != (asection *) 0);
  26106. +        name = bfd_get_section_name (abfd, sec->output_section);
  26107. +        if (strcmp (name, ".sdata") != 0
  26108. +        && strcmp (name, ".sbss") != 0)
  26109. +          {
  26110. +        (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
  26111. +                       bfd_archive_filename (input_bfd),
  26112. +                       sym_name,
  26113. +                       ppc_elf_howto_table[(int) r_type]->name,
  26114. +                       name);
  26115. +          }
  26116. +        addend -= (sdata->sym_hash->root.u.def.value
  26117. +               + sdata->sym_hash->root.u.def.section->output_section->vma
  26118. +               + sdata->sym_hash->root.u.def.section->output_offset);
  26119. +      }
  26120. +      break;
  26121. +
  26122. +    /* relocate against _SDA2_BASE_ */
  26123. +    case (int) R_PPC_EMB_SDA2REL:
  26124. +      {
  26125. +        const char *name;
  26126. +
  26127. +        BFD_ASSERT (sec != (asection *) 0);
  26128. +        name = bfd_get_section_name (abfd, sec->output_section);
  26129. +        if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0)
  26130. +          {
  26131. +        (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
  26132. +                       bfd_archive_filename (input_bfd),
  26133. +                       sym_name,
  26134. +                       ppc_elf_howto_table[(int) r_type]->name,
  26135. +                       name);
  26136. +
  26137. +        bfd_set_error (bfd_error_bad_value);
  26138. +        ret = false;
  26139. +        continue;
  26140. +          }
  26141. +        addend -= (sdata2->sym_hash->root.u.def.value
  26142. +               + sdata2->sym_hash->root.u.def.section->output_section->vma
  26143. +               + sdata2->sym_hash->root.u.def.section->output_offset);
  26144. +      }
  26145. +      break;
  26146. +
  26147. +    /* relocate against either _SDA_BASE_, _SDA2_BASE_, or 0 */
  26148. +    case (int) R_PPC_EMB_SDA21:
  26149. +    case (int) R_PPC_EMB_RELSDA:
  26150. +      {
  26151. +        const char *name;
  26152. +        int reg;
  26153. +
  26154. +        BFD_ASSERT (sec != (asection *) 0);
  26155. +        name = bfd_get_section_name (abfd, sec->output_section);
  26156. +        if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)
  26157. +          {
  26158. +        reg = 13;
  26159. +        addend -= (sdata->sym_hash->root.u.def.value
  26160. +               + sdata->sym_hash->root.u.def.section->output_section->vma
  26161. +               + sdata->sym_hash->root.u.def.section->output_offset);
  26162. +          }
  26163. +
  26164. +        else if (strcmp (name, ".sdata2") == 0
  26165. +             || strcmp (name, ".sbss2") == 0)
  26166. +          {
  26167. +        reg = 2;
  26168. +        addend -= (sdata2->sym_hash->root.u.def.value
  26169. +               + sdata2->sym_hash->root.u.def.section->output_section->vma
  26170. +               + sdata2->sym_hash->root.u.def.section->output_offset);
  26171. +          }
  26172. +
  26173. +        else if (strcmp (name, ".PPC.EMB.sdata0") == 0
  26174. +             || strcmp (name, ".PPC.EMB.sbss0") == 0)
  26175. +          {
  26176. +        reg = 0;
  26177. +          }
  26178. +
  26179. +        else
  26180. +          {
  26181. +        (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
  26182. +                       bfd_archive_filename (input_bfd),
  26183. +                       sym_name,
  26184. +                       ppc_elf_howto_table[(int) r_type]->name,
  26185. +                       name);
  26186. +
  26187. +        bfd_set_error (bfd_error_bad_value);
  26188. +        ret = false;
  26189. +        continue;
  26190. +          }
  26191. +
  26192. +        if (r_type == R_PPC_EMB_SDA21)
  26193. +          {            /* fill in register field */
  26194. +        insn = bfd_get_32 (output_bfd, contents + offset);
  26195. +        insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
  26196. +        bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
  26197. +          }
  26198. +      }
  26199. +      break;
  26200. +
  26201. +    /* Relocate against the beginning of the section */
  26202. +    case (int) R_PPC_SECTOFF:
  26203. +    case (int) R_PPC_SECTOFF_LO:
  26204. +    case (int) R_PPC_SECTOFF_HI:
  26205. +      BFD_ASSERT (sec != (asection *) 0);
  26206. +      addend -= sec->output_section->vma;
  26207. +      break;
  26208. +
  26209. +    case (int) R_PPC_SECTOFF_HA:
  26210. +      BFD_ASSERT (sec != (asection *) 0);
  26211. +      addend -= sec->output_section->vma;
  26212. +      addend += ((relocation + addend) & 0x8000) << 1;
  26213. +      break;
  26214. +
  26215. +    /* Negative relocations */
  26216. +    case (int) R_PPC_EMB_NADDR32:
  26217. +    case (int) R_PPC_EMB_NADDR16:
  26218. +    case (int) R_PPC_EMB_NADDR16_LO:
  26219. +    case (int) R_PPC_EMB_NADDR16_HI:
  26220. +      addend -= 2 * relocation;
  26221. +      break;
  26222. +
  26223. +    case (int) R_PPC_EMB_NADDR16_HA:
  26224. +      addend -= 2 * relocation;
  26225. +      addend += ((relocation + addend) & 0x8000) << 1;
  26226. +      break;
  26227. +
  26228. +    /* NOP relocation that prevents garbage collecting linkers from omitting a
  26229. +       reference.  */
  26230. +    case (int) R_PPC_EMB_MRKREF:
  26231. +      continue;
  26232. +
  26233. +    case (int) R_PPC_COPY:
  26234. +    case (int) R_PPC_GLOB_DAT:
  26235. +    case (int) R_PPC_JMP_SLOT:
  26236. +    case (int) R_PPC_RELATIVE:
  26237. +    case (int) R_PPC_PLT32:
  26238. +    case (int) R_PPC_PLTREL32:
  26239. +    case (int) R_PPC_PLT16_LO:
  26240. +    case (int) R_PPC_PLT16_HI:
  26241. +    case (int) R_PPC_PLT16_HA:
  26242. +    case (int) R_PPC_EMB_RELSEC16:
  26243. +    case (int) R_PPC_EMB_RELST_LO:
  26244. +    case (int) R_PPC_EMB_RELST_HI:
  26245. +    case (int) R_PPC_EMB_RELST_HA:
  26246. +    case (int) R_PPC_EMB_BIT_FLD:
  26247. +      (*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."),
  26248. +                 bfd_archive_filename (input_bfd),
  26249. +                 ppc_elf_howto_table[(int) r_type]->name,
  26250. +                 sym_name);
  26251. +
  26252. +      bfd_set_error (bfd_error_invalid_operation);
  26253. +      ret = false;
  26254. +      continue;
  26255. +
  26256. +    case (int) R_PPC_GNU_VTINHERIT:
  26257. +    case (int) R_PPC_GNU_VTENTRY:
  26258. +      /* These are no-ops in the end.  */
  26259. +      continue;
  26260. +    }
  26261. +
  26262. +#ifdef DEBUG
  26263. +      fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n",
  26264. +           howto->name,
  26265. +           (int) r_type,
  26266. +           sym_name,
  26267. +           r_symndx,
  26268. +           (long) offset,
  26269. +           (long) addend);
  26270. +#endif
  26271. +
  26272. +      r = _bfd_final_link_relocate (howto,
  26273. +                    input_bfd,
  26274. +                    input_section,
  26275. +                    contents,
  26276. +                    offset,
  26277. +                    relocation,
  26278. +                    addend);
  26279. +
  26280. +      if (r == bfd_reloc_ok)
  26281. +    ;
  26282. +      else if (r == bfd_reloc_overflow)
  26283. +    {
  26284. +      const char *name;
  26285. +
  26286. +      if (h != NULL)
  26287. +        {
  26288. +          if (h->root.type == bfd_link_hash_undefweak
  26289. +          && howto->pc_relative)
  26290. +        {
  26291. +          /* Assume this is a call protected by other code that
  26292. +             detect the symbol is undefined.  If this is the case,
  26293. +             we can safely ignore the overflow.  If not, the
  26294. +             program is hosed anyway, and a little warning isn't
  26295. +             going to help.  */
  26296. +
  26297. +          continue;
  26298. +        }
  26299. +
  26300. +          name = h->root.root.string;
  26301. +        }
  26302. +      else
  26303. +        {
  26304. +          name = bfd_elf_string_from_elf_section (input_bfd,
  26305. +                              symtab_hdr->sh_link,
  26306. +                              sym->st_name);
  26307. +          if (name == NULL)
  26308. +        continue;
  26309. +          if (*name == '\0')
  26310. +        name = bfd_section_name (input_bfd, sec);
  26311. +        }
  26312. +
  26313. +      if (! (*info->callbacks->reloc_overflow) (info,
  26314. +                           name,
  26315. +                           howto->name,
  26316. +                           (bfd_vma) 0,
  26317. +                           input_bfd,
  26318. +                           input_section,
  26319. +                           offset))
  26320. +        return false;
  26321. +    }
  26322. +      else
  26323. +    ret = false;
  26324. +    }
  26325. +
  26326. +#ifdef DEBUG
  26327. +  fprintf (stderr, "\n");
  26328. +#endif
  26329. +
  26330. +  return ret;
  26331. +}
  26332. +
  26333. +static enum elf_reloc_type_class
  26334. +ppc_elf_reloc_type_class (rela)
  26335. +     const Elf_Internal_Rela *rela;
  26336. +{
  26337. +  switch ((int) ELF32_R_TYPE (rela->r_info))
  26338. +    {
  26339. +    case R_PPC_RELATIVE:
  26340. +      return reloc_class_relative;
  26341. +    case R_PPC_REL24:
  26342. +    case R_PPC_ADDR24:
  26343. +    case R_PPC_JMP_SLOT:
  26344. +      return reloc_class_plt;
  26345. +    case R_PPC_COPY:
  26346. +      return reloc_class_copy;
  26347. +    default:
  26348. +      return reloc_class_normal;
  26349. +    }
  26350. +}
  26351. +
  26352. +/* Support for core dump NOTE sections */
  26353. +static boolean
  26354. +ppc_elf_grok_prstatus (abfd, note)
  26355. +     bfd *abfd;
  26356. +     Elf_Internal_Note *note;
  26357. +{
  26358. +  int offset;
  26359. +  unsigned int raw_size;
  26360. +
  26361. +  switch (note->descsz)
  26362. +    {
  26363. +      default:
  26364. +    return false;
  26365. +
  26366. +      case 268:        /* Linux/PPC */
  26367. +    /* pr_cursig */
  26368. +    elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
  26369. +
  26370. +    /* pr_pid */
  26371. +    elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
  26372. +
  26373. +    /* pr_reg */
  26374. +    offset = 72;
  26375. +    raw_size = 192;
  26376. +
  26377. +    break;
  26378. +    }
  26379. +
  26380. +  /* Make a ".reg/999" section.  */
  26381. +  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
  26382. +                      raw_size, note->descpos + offset);
  26383. +}
  26384. +
  26385. +static boolean
  26386. +ppc_elf_grok_psinfo (abfd, note)
  26387. +     bfd *abfd;
  26388. +     Elf_Internal_Note *note;
  26389. +{
  26390. +  switch (note->descsz)
  26391. +    {
  26392. +      default:
  26393. +    return false;
  26394. +
  26395. +      case 128:        /* Linux/PPC elf_prpsinfo */
  26396. +    elf_tdata (abfd)->core_program
  26397. +     = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
  26398. +    elf_tdata (abfd)->core_command
  26399. +     = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
  26400. +    }
  26401. +
  26402. +  /* Note that for some reason, a spurious space is tacked
  26403. +     onto the end of the args in some (at least one anyway)
  26404. +     implementations, so strip it off if it exists.  */
  26405. +
  26406. +  {
  26407. +    char *command = elf_tdata (abfd)->core_command;
  26408. +    int n = strlen (command);
  26409. +
  26410. +    if (0 < n && command[n - 1] == ' ')
  26411. +      command[n - 1] = '\0';
  26412. +  }
  26413. +
  26414. +  return true;
  26415. +}
  26416. +
  26417. +#define TARGET_BIG_SYM        bfd_elf32_amiga_vec
  26418. +#define TARGET_BIG_NAME        "elf32-amiga"
  26419. +#define ELF_ARCH        bfd_arch_powerpc
  26420. +#define ELF_MACHINE_CODE    EM_PPC
  26421. +#define ELF_MAXPAGESIZE        0x10000
  26422. +#define elf_info_to_howto    ppc_elf_info_to_howto
  26423. +
  26424. +#ifdef  EM_CYGNUS_POWERPC
  26425. +#define ELF_MACHINE_ALT1    EM_CYGNUS_POWERPC
  26426. +#endif
  26427. +
  26428. +#ifdef EM_PPC_OLD
  26429. +#define ELF_MACHINE_ALT2    EM_PPC_OLD
  26430. +#endif
  26431. +
  26432. +#define elf_backend_plt_not_loaded    1
  26433. +#define elf_backend_got_symbol_offset    4
  26434. +#define elf_backend_can_gc_sections    1
  26435. +#define elf_backend_can_refcount    1
  26436. +#define elf_backend_got_header_size    12
  26437. +#define elf_backend_plt_header_size    PLT_INITIAL_ENTRY_SIZE
  26438. +#define elf_backend_rela_normal        1
  26439. +
  26440. +#define bfd_elf32_bfd_merge_private_bfd_data    ppc_elf_merge_private_bfd_data
  26441. +#define bfd_elf32_bfd_relax_section             ppc_elf_relax_section
  26442. +#define bfd_elf32_bfd_reloc_type_lookup        ppc_elf_reloc_type_lookup
  26443. +#define bfd_elf32_bfd_set_private_flags        ppc_elf_set_private_flags
  26444. +#define bfd_elf32_bfd_final_link        _bfd_elf32_gc_common_final_link
  26445. +
  26446. +#define elf_backend_object_p            ppc_elf_object_p
  26447. +#define elf_backend_gc_mark_hook        ppc_elf_gc_mark_hook
  26448. +#define elf_backend_gc_sweep_hook        ppc_elf_gc_sweep_hook
  26449. +#define elf_backend_section_from_shdr        ppc_elf_section_from_shdr
  26450. +#define elf_backend_relocate_section        ppc_elf_relocate_section
  26451. +#define elf_backend_create_dynamic_sections    ppc_elf_create_dynamic_sections
  26452. +#define elf_backend_check_relocs        ppc_elf_check_relocs
  26453. +#define elf_backend_adjust_dynamic_symbol    ppc_elf_adjust_dynamic_symbol
  26454. +#define elf_backend_add_symbol_hook        ppc_elf_add_symbol_hook
  26455. +#define elf_backend_size_dynamic_sections    ppc_elf_size_dynamic_sections
  26456. +#define elf_backend_finish_dynamic_symbol    ppc_elf_finish_dynamic_symbol
  26457. +#define elf_backend_finish_dynamic_sections    ppc_elf_finish_dynamic_sections
  26458. +#define elf_backend_fake_sections        ppc_elf_fake_sections
  26459. +#define elf_backend_additional_program_headers    ppc_elf_additional_program_headers
  26460. +#define elf_backend_modify_segment_map        ppc_elf_modify_segment_map
  26461. +#define elf_backend_grok_prstatus        ppc_elf_grok_prstatus
  26462. +#define elf_backend_grok_psinfo            ppc_elf_grok_psinfo
  26463. +#define elf_backend_reloc_type_class        ppc_elf_reloc_type_class
  26464. +
  26465. +#include "elf32-target.h"
  26466. diff -urNEBb binutils-2.14-orig/bfd/elf32-i386-amithlon.c binutils-2.14/bfd/elf32-i386-amithlon.c
  26467. --- binutils-2.14-orig/bfd/elf32-i386-amithlon.c    1970-01-01 01:00:00.000000000 +0100
  26468. +++ binutils-2.14/bfd/elf32-i386-amithlon.c    2003-12-02 14:09:39.000000000 +0100
  26469. @@ -0,0 +1,198 @@
  26470. +/* Intel IA-32 specific support for 32-bit big endian ELF on Amithlon.
  26471. +   Copyright 2002 Free Software Foundation, Inc.
  26472. +   Written by Martin Blom.
  26473. +
  26474. +This file is part of BFD, the Binary File Descriptor library.
  26475. +
  26476. +This program is free software; you can redistribute it and/or modify
  26477. +it under the terms of the GNU General Public License as published by
  26478. +the Free Software Foundation; either version 2 of the License, or
  26479. +(at your option) any later version.
  26480. +
  26481. +This program is distributed in the hope that it will be useful,
  26482. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  26483. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26484. +GNU General Public License for more details.
  26485. +
  26486. +You should have received a copy of the GNU General Public License
  26487. +along with this program; if not, write to the Free Software
  26488. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  26489. +
  26490. +#define TARGET_LITTLE_SYM        bfd_elf32_i386_amithlon_vec
  26491. +#define TARGET_LITTLE_NAME        "elf32-i386-amithlon"
  26492. +#define TARGET_BIG_SYM            bfd_elf32_i386be_amithlon_vec
  26493. +#define TARGET_BIG_NAME            "elf32-i386be-amithlon"
  26494. +#define ELF_ARCH            bfd_arch_i386
  26495. +#define ELF_MACHINE_CODE        EM_386
  26496. +#define ELF_MAXPAGESIZE            32  //0x1000
  26497. +
  26498. +#include "bfd.h"
  26499. +#include "sysdep.h"
  26500. +#include "elf-bfd.h"
  26501. +
  26502. +/* Forward declarations */
  26503. +extern const bfd_target bfd_elf32_i386_amithlon_vec;
  26504. +extern const bfd_target bfd_elf32_i386be_amithlon_vec;
  26505. +
  26506. +static boolean elf_i386_relocate_section
  26507. +  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
  26508. +       Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
  26509. +
  26510. +static boolean elf_i386_finish_dynamic_sections
  26511. +  PARAMS ((bfd *, struct bfd_link_info *));
  26512. +
  26513. +static boolean elf_i386_finish_dynamic_symbol
  26514. +  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
  26515. +       Elf_Internal_Sym *));
  26516. +
  26517. +boolean elf_link_output_relocs
  26518. +  PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
  26519. +
  26520. +#define swap_xvec(xvec,c)                                   \
  26521. +do {                                                        \
  26522. +  xvec->bfd_getx64         = bfd_get ## c ## 64;            \
  26523. +  xvec->bfd_getx_signed_64 = bfd_get ## c ## _signed_64;    \
  26524. +  xvec->bfd_putx64         = bfd_put ## c ## 64;            \
  26525. +  xvec->bfd_getx32         = bfd_get ## c ## 32;            \
  26526. +  xvec->bfd_getx_signed_32 = bfd_get ## c ## _signed_32;    \
  26527. +  xvec->bfd_putx32         = bfd_put ## c ## 32;            \
  26528. +  xvec->bfd_getx16         = bfd_get ## c ## 16;            \
  26529. +  xvec->bfd_getx_signed_16 = bfd_get ## c ## _signed_16;    \
  26530. +  xvec->bfd_putx16         = bfd_put ## c ## 16;            \
  26531. +} while(0)
  26532. +
  26533. +/* Relocate a big endian i386 ELF section.  */
  26534. +
  26535. +static boolean
  26536. +amithlon_relocate_section (output_bfd, info, input_bfd, input_section,
  26537. +               contents, relocs, local_syms, local_sections)
  26538. +     bfd *output_bfd;
  26539. +     struct bfd_link_info *info;
  26540. +     bfd *input_bfd;
  26541. +     asection *input_section;
  26542. +     bfd_byte *contents;
  26543. +     Elf_Internal_Rela *relocs;
  26544. +     Elf_Internal_Sym *local_syms;
  26545. +     asection **local_sections;
  26546. +{
  26547. +  boolean switched_input  = false;
  26548. +  boolean switched_output = false;
  26549. +  boolean rc;
  26550. +
  26551. +  /* Since code sections are actually little endian, no matter what
  26552. +     endian mode we're operating in, this rather dirty hack is used to
  26553. +     make sure the correct data access routines are used. */
  26554. +
  26555. +  if ((bfd_get_section_flags (input_bfd, input_section) & SEC_CODE))
  26556. +  {
  26557. +    if (input_bfd->xvec == &bfd_elf32_i386be_amithlon_vec)
  26558. +    {
  26559. +      switched_input = true;
  26560. +
  26561. +      swap_xvec(input_bfd->xvec,l);
  26562. +    }
  26563. +    
  26564. +    if (output_bfd->xvec == &bfd_elf32_i386be_amithlon_vec)
  26565. +    {
  26566. +      switched_output = true;
  26567. +
  26568. +      swap_xvec(output_bfd->xvec,l);
  26569. +    }
  26570. +  }
  26571. +
  26572. +  rc = elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
  26573. +                  contents, relocs,
  26574. +                  local_syms, local_sections);
  26575. +  
  26576. +  if (switched_input)
  26577. +  {
  26578. +    swap_xvec(input_bfd->xvec,b);
  26579. +  }
  26580. +
  26581. +  if (switched_output)
  26582. +  {
  26583. +    swap_xvec(output_bfd->xvec,b);
  26584. +  }
  26585. +  
  26586. +  return rc;
  26587. +}  
  26588. +
  26589. +static boolean
  26590. +amithlon_finish_dynamic_sections (output_bfd, info)
  26591. +     bfd *output_bfd;
  26592. +     struct bfd_link_info *info;
  26593. +{
  26594. +  boolean switched_output = false;
  26595. +  boolean rc;
  26596. +
  26597. +  /* Since code sections are actually little endian, no matter what
  26598. +     endian mode we're operating in, this rather dirty hack is used to
  26599. +     make sure the correct data access routines are used. */
  26600. +
  26601. +  if (output_bfd->xvec == &bfd_elf32_i386be_amithlon_vec)
  26602. +  {
  26603. +    switched_output = true;
  26604. +
  26605. +    swap_xvec(output_bfd->xvec,l);
  26606. +  }
  26607. +
  26608. +  rc = elf_i386_finish_dynamic_sections (output_bfd, info);
  26609. +
  26610. +  if (switched_output)
  26611. +  {
  26612. +    swap_xvec(output_bfd->xvec,b);
  26613. +  }
  26614. +  
  26615. +  return rc;
  26616. +}
  26617. +
  26618. +static boolean
  26619. +amithlon_finish_dynamic_symbol (output_bfd, info, h, sym)
  26620. +     bfd *output_bfd;
  26621. +     struct bfd_link_info *info;
  26622. +     struct elf_link_hash_entry *h;
  26623. +     Elf_Internal_Sym *sym;
  26624. +{
  26625. +  boolean switched_output = false;
  26626. +  boolean rc;
  26627. +
  26628. +  /* Since code sections are actually little endian, no matter what
  26629. +     endian mode we're operating in, this rather dirty hack is used to
  26630. +     make sure the correct data access routines are used. */
  26631. +
  26632. +  if (output_bfd->xvec == &bfd_elf32_i386be_amithlon_vec)
  26633. +  {
  26634. +    switched_output = true;
  26635. +
  26636. +    swap_xvec(output_bfd->xvec,l);
  26637. +  }
  26638. +
  26639. +  rc = elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym);
  26640. +
  26641. +  if (switched_output)
  26642. +  {
  26643. +    swap_xvec(output_bfd->xvec,b);
  26644. +  }
  26645. +  
  26646. +  return rc;
  26647. +}
  26648. +
  26649. +static bfd_size_type
  26650. +amithlon_additional_program_headers (abfd)
  26651. +     bfd *abfd;
  26652. +{
  26653. +//  printf("big: %x little: %x\n",
  26654. +//     &bfd_elf32_i386be_amithlon_vec,
  26655. +//     &bfd_elf32_i386_amithlon_vec);
  26656. +  // headers, text, rodata, data+bss
  26657. +  return -2+4;
  26658. +}
  26659. +
  26660. +#define elf_backend_relocate_section            amithlon_relocate_section
  26661. +#define elf_backend_finish_dynamic_sections     amithlon_finish_dynamic_sections
  26662. +#define elf_backend_finish_dynamic_symbol       amithlon_finish_dynamic_symbol
  26663. +#define elf_backend_additional_program_headers  amithlon_additional_program_headers
  26664. +
  26665. +#define ELF32_I386_RELOCATABLE_EXECUTABLES 1
  26666. +
  26667. +#include "elf32-i386.c"
  26668. diff -urNEBb binutils-2.14-orig/bfd/elf32-i386.c binutils-2.14/bfd/elf32-i386.c
  26669. --- binutils-2.14-orig/bfd/elf32-i386.c    2003-05-02 18:06:14.000000000 +0200
  26670. +++ binutils-2.14/bfd/elf32-i386.c    2003-12-02 14:09:39.000000000 +0100
  26671. @@ -24,6 +24,10 @@
  26672.  #include "libbfd.h"
  26673.  #include "elf-bfd.h"
  26674.  
  26675. +#ifndef ELF32_I386_RELOCATABLE_EXECUTABLES
  26676. +#define ELF32_I386_RELOCATABLE_EXECUTABLES 0
  26677. +#endif
  26678. +
  26679.  static reloc_howto_type *elf_i386_reloc_type_lookup
  26680.    PARAMS ((bfd *, bfd_reloc_code_real_type));
  26681.  static void elf_i386_info_to_howto_rel
  26682. @@ -1105,7 +1109,7 @@
  26683.           may need to keep relocations for symbols satisfied by a
  26684.           dynamic library if we manage to avoid copy relocs for the
  26685.           symbol.  */
  26686. -      if ((info->shared
  26687. +      if (((ELF32_I386_RELOCATABLE_EXECUTABLES || info->shared)
  26688.             && (sec->flags & SEC_ALLOC) != 0
  26689.             && (r_type != R_386_PC32
  26690.             || (h != NULL
  26691. @@ -1673,7 +1677,7 @@
  26692.       space for pc-relative relocs that have become local due to symbol
  26693.       visibility changes.  */
  26694.  
  26695. -  if (info->shared)
  26696. +  if (ELF32_I386_RELOCATABLE_EXECUTABLES || info->shared)
  26697.      {
  26698.        if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
  26699.        && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
  26700. @@ -2421,7 +2425,7 @@
  26701.            || (input_section->flags & SEC_ALLOC) == 0)
  26702.          break;
  26703.  
  26704. -      if ((info->shared
  26705. +      if (((ELF32_I386_RELOCATABLE_EXECUTABLES || info->shared)
  26706.             && (r_type != R_386_PC32
  26707.             || (h != NULL
  26708.                 && h->dynindx != -1
  26709. @@ -2466,6 +2470,7 @@
  26710.          memset (&outrel, 0, sizeof outrel);
  26711.            else if (h != NULL
  26712.                 && h->dynindx != -1
  26713. +               && !(ELF32_I386_RELOCATABLE_EXECUTABLES && !info->shared)
  26714.                 && (r_type == R_386_PC32
  26715.                 || !info->shared
  26716.                 || !info->symbolic
  26717. @@ -3384,14 +3389,20 @@
  26718.  #define elf_backend_copy_indirect_symbol      elf_i386_copy_indirect_symbol
  26719.  #define elf_backend_create_dynamic_sections   elf_i386_create_dynamic_sections
  26720.  #define elf_backend_fake_sections          elf_i386_fake_sections
  26721. +#ifndef elf_backend_finish_dynamic_sections
  26722.  #define elf_backend_finish_dynamic_sections   elf_i386_finish_dynamic_sections
  26723. +#endif
  26724. +#ifndef elf_backend_finish_dynamic_symbol
  26725.  #define elf_backend_finish_dynamic_symbol     elf_i386_finish_dynamic_symbol
  26726. +#endif
  26727.  #define elf_backend_gc_mark_hook          elf_i386_gc_mark_hook
  26728.  #define elf_backend_gc_sweep_hook          elf_i386_gc_sweep_hook
  26729.  #define elf_backend_grok_prstatus          elf_i386_grok_prstatus
  26730.  #define elf_backend_grok_psinfo              elf_i386_grok_psinfo
  26731.  #define elf_backend_reloc_type_class          elf_i386_reloc_type_class
  26732. +#ifndef elf_backend_relocate_section
  26733.  #define elf_backend_relocate_section          elf_i386_relocate_section
  26734. +#endif
  26735.  #define elf_backend_size_dynamic_sections     elf_i386_size_dynamic_sections
  26736.  
  26737.  #include "elf32-target.h"
  26738. diff -urNEBb binutils-2.14-orig/bfd/elf32-morphos.c binutils-2.14/bfd/elf32-morphos.c
  26739. --- binutils-2.14-orig/bfd/elf32-morphos.c    1970-01-01 01:00:00.000000000 +0100
  26740. +++ binutils-2.14/bfd/elf32-morphos.c    2003-12-02 14:09:39.000000000 +0100
  26741. @@ -0,0 +1,7137 @@
  26742. +/* PowerPC-specific support for 32-bit ELF
  26743. +   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
  26744. +   Free Software Foundation, Inc.
  26745. +   Written by Ian Lance Taylor, Cygnus Support.
  26746. +
  26747. +This file is part of BFD, the Binary File Descriptor library.
  26748. +
  26749. +This program is free software; you can redistribute it and/or modify
  26750. +it under the terms of the GNU General Public License as published by
  26751. +the Free Software Foundation; either version 2 of the License, or
  26752. +(at your option) any later version.
  26753. +
  26754. +This program is distributed in the hope that it will be useful,
  26755. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  26756. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26757. +GNU General Public License for more details.
  26758. +
  26759. +You should have received a copy of the GNU General Public License
  26760. +along with this program; if not, write to the Free Software
  26761. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  26762. +
  26763. +/* This file is based on a preliminary PowerPC ELF ABI.  The
  26764. +   information may not match the final PowerPC ELF ABI.  It includes
  26765. +   suggestions from the in-progress Embedded PowerPC ABI, and that
  26766. +   information may also not match.  */
  26767. +
  26768. +#define ARCH_SIZE        32
  26769. +
  26770. +#include "bfd.h"
  26771. +#include "sysdep.h"
  26772. +#include "bfdlink.h"
  26773. +#include "genlink.h"
  26774. +#include "libbfd.h"
  26775. +#include "elf-bfd.h"
  26776. +#include "elf/ppc.h"
  26777. +
  26778. +#define USE_RELA        /* we want RELA relocations, not REL */
  26779. +
  26780. +/* Renaming structures, typedefs, macros and functions to be size-specific.  */
  26781. +#define Elf_External_Ehdr    NAME(Elf,External_Ehdr)
  26782. +#define Elf_External_Sym    NAME(Elf,External_Sym)
  26783. +#define Elf_External_Shdr    NAME(Elf,External_Shdr)
  26784. +#define Elf_External_Phdr    NAME(Elf,External_Phdr)
  26785. +#define Elf_External_Rel    NAME(Elf,External_Rel)
  26786. +#define Elf_External_Rela    NAME(Elf,External_Rela)
  26787. +#define Elf_External_Dyn    NAME(Elf,External_Dyn)
  26788. +
  26789. +#define elf_core_file_failing_command    NAME(bfd_elf,core_file_failing_command)
  26790. +#define elf_core_file_failing_signal    NAME(bfd_elf,core_file_failing_signal)
  26791. +#define elf_core_file_matches_executable_p \
  26792. +  NAME(bfd_elf,core_file_matches_executable_p)
  26793. +#define elf_object_p            NAME(bfd_elf,object_p)
  26794. +#define elf_core_file_p            NAME(bfd_elf,core_file_p)
  26795. +#define elf_get_symtab_upper_bound    NAME(bfd_elf,get_symtab_upper_bound)
  26796. +#define elf_get_dynamic_symtab_upper_bound \
  26797. +  NAME(bfd_elf,get_dynamic_symtab_upper_bound)
  26798. +#define elf_swap_reloc_in        NAME(bfd_elf,swap_reloc_in)
  26799. +#define elf_swap_reloca_in        NAME(bfd_elf,swap_reloca_in)
  26800. +#define elf_swap_reloc_out        NAME(bfd_elf,swap_reloc_out)
  26801. +#define elf_swap_reloca_out        NAME(bfd_elf,swap_reloca_out)
  26802. +#define elf_swap_symbol_in        NAME(bfd_elf,swap_symbol_in)
  26803. +#define elf_swap_symbol_out        NAME(bfd_elf,swap_symbol_out)
  26804. +#define elf_swap_phdr_in        NAME(bfd_elf,swap_phdr_in)
  26805. +#define elf_swap_phdr_out        NAME(bfd_elf,swap_phdr_out)
  26806. +#define elf_swap_dyn_in            NAME(bfd_elf,swap_dyn_in)
  26807. +#define elf_swap_dyn_out        NAME(bfd_elf,swap_dyn_out)
  26808. +#define elf_get_reloc_upper_bound    NAME(bfd_elf,get_reloc_upper_bound)
  26809. +#define elf_canonicalize_reloc        NAME(bfd_elf,canonicalize_reloc)
  26810. +#define elf_slurp_symbol_table        NAME(bfd_elf,slurp_symbol_table)
  26811. +#define elf_get_symtab            NAME(bfd_elf,get_symtab)
  26812. +#define elf_canonicalize_dynamic_symtab \
  26813. +  NAME(bfd_elf,canonicalize_dynamic_symtab)
  26814. +#define elf_make_empty_symbol        NAME(bfd_elf,make_empty_symbol)
  26815. +#define elf_get_symbol_info        NAME(bfd_elf,get_symbol_info)
  26816. +#define elf_get_lineno            NAME(bfd_elf,get_lineno)
  26817. +#define elf_set_arch_mach        NAME(bfd_elf,set_arch_mach)
  26818. +#define elf_find_nearest_line        NAME(bfd_elf,find_nearest_line)
  26819. +#define elf_sizeof_headers        NAME(bfd_elf,sizeof_headers)
  26820. +#define elf_set_section_contents    NAME(bfd_elf,set_section_contents)
  26821. +#define elf_no_info_to_howto        NAME(bfd_elf,no_info_to_howto)
  26822. +#define elf_no_info_to_howto_rel    NAME(bfd_elf,no_info_to_howto_rel)
  26823. +#define elf_find_section        NAME(bfd_elf,find_section)
  26824. +#define elf_bfd_link_add_symbols    NAME(bfd_elf,bfd_link_add_symbols)
  26825. +#define elf_add_dynamic_entry        NAME(bfd_elf,add_dynamic_entry)
  26826. +#define elf_write_shdrs_and_ehdr    NAME(bfd_elf,write_shdrs_and_ehdr)
  26827. +#define elf_write_out_phdrs        NAME(bfd_elf,write_out_phdrs)
  26828. +#define elf_write_relocs        NAME(bfd_elf,write_relocs)
  26829. +#define elf_slurp_reloc_table        NAME(bfd_elf,slurp_reloc_table)
  26830. +#define elf_link_create_dynamic_sections \
  26831. +  NAME(bfd_elf,link_create_dynamic_sections)
  26832. +#define elf_bfd_discard_info        NAME(bfd_elf,discard_info)
  26833. +#define elf_reloc_symbol_deleted_p    NAME(_bfd_elf,reloc_symbol_deleted_p)
  26834. +#define elf_link_record_dynamic_symbol  _bfd_elf_link_record_dynamic_symbol
  26835. +#define elf_bfd_final_link        NAME(bfd_elf,bfd_final_link)
  26836. +#define elf_create_pointer_linker_section NAME(bfd_elf,create_pointer_linker_section)
  26837. +#define elf_finish_pointer_linker_section NAME(bfd_elf,finish_pointer_linker_section)
  26838. +#define elf_gc_sections            NAME(_bfd_elf,gc_sections)
  26839. +#define elf_gc_common_finalize_got_offsets \
  26840. +  NAME(_bfd_elf,gc_common_finalize_got_offsets)
  26841. +#define elf_gc_common_final_link    NAME(_bfd_elf,gc_common_final_link)
  26842. +#define elf_gc_record_vtinherit        NAME(_bfd_elf,gc_record_vtinherit)
  26843. +#define elf_gc_record_vtentry        NAME(_bfd_elf,gc_record_vtentry)
  26844. +#define elf_link_record_local_dynamic_symbol \
  26845. +  NAME(_bfd_elf,link_record_local_dynamic_symbol)
  26846. +
  26847. +#define ELF_R_INFO(X,Y)    ELF32_R_INFO(X,Y)
  26848. +#define ELF_R_SYM(X)    ELF32_R_SYM(X)
  26849. +#define ELF_R_TYPE(X)    ELF32_R_TYPE(X)
  26850. +#define ELFCLASS    ELFCLASS32
  26851. +#define FILE_ALIGN    4
  26852. +#define LOG_FILE_ALIGN    2
  26853. +
  26854. +#define H_PUT_WORD        H_PUT_32
  26855. +#define H_PUT_SIGNED_WORD    H_PUT_S32
  26856. +#define H_GET_WORD        H_GET_32
  26857. +#define H_GET_SIGNED_WORD    H_GET_S32
  26858. +
  26859. +#define elf_stringtab_init _bfd_elf_stringtab_init
  26860. +
  26861. +#define section_from_elf_index bfd_section_from_elf_index
  26862. +
  26863. +static int ddr_count;
  26864. +static unsigned *ddr_ptr;
  26865. +
  26866. +static reloc_howto_type *ppc_elf_reloc_type_lookup
  26867. +  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
  26868. +static void ppc_elf_info_to_howto
  26869. +  PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst));
  26870. +static void ppc_elf_howto_init PARAMS ((void));
  26871. +static int ppc_elf_sort_rela PARAMS ((const PTR, const PTR));
  26872. +static boolean ppc_elf_relax_section
  26873. +  PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
  26874. +static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
  26875. +  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
  26876. +static boolean ppc_elf_object_p PARAMS ((bfd *));
  26877. +static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword));
  26878. +static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
  26879. +
  26880. +static int ppc_elf_additional_program_headers PARAMS ((bfd *));
  26881. +static boolean ppc_elf_modify_segment_map PARAMS ((bfd *));
  26882. +
  26883. +static asection *ppc_elf_create_got
  26884. +  PARAMS ((bfd *, struct bfd_link_info *));
  26885. +static boolean ppc_elf_create_dynamic_sections
  26886. +  PARAMS ((bfd *, struct bfd_link_info *));
  26887. +
  26888. +static boolean ppc_elf_section_from_shdr PARAMS ((bfd *,
  26889. +                          Elf32_Internal_Shdr *,
  26890. +                          const char *));
  26891. +static boolean ppc_elf_fake_sections
  26892. +  PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
  26893. +
  26894. +static elf_linker_section_t *ppc_elf_create_linker_section
  26895. +  PARAMS ((bfd *abfd,
  26896. +       struct bfd_link_info *info,
  26897. +       enum elf_linker_section_enum));
  26898. +
  26899. +static boolean ppc_elf_check_relocs PARAMS ((bfd *,
  26900. +                         struct bfd_link_info *,
  26901. +                         asection *,
  26902. +                         const Elf_Internal_Rela *));
  26903. +
  26904. +static asection * ppc_elf_gc_mark_hook PARAMS ((asection *sec,
  26905. +                        struct bfd_link_info *info,
  26906. +                        Elf_Internal_Rela *rel,
  26907. +                        struct elf_link_hash_entry *h,
  26908. +                        Elf_Internal_Sym *sym));
  26909. +
  26910. +static boolean ppc_elf_gc_sweep_hook PARAMS ((bfd *abfd,
  26911. +                          struct bfd_link_info *info,
  26912. +                          asection *sec,
  26913. +                          const Elf_Internal_Rela *relocs));
  26914. +
  26915. +static boolean ppc_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *,
  26916. +                              struct elf_link_hash_entry *));
  26917. +
  26918. +static boolean ppc_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
  26919. +
  26920. +static boolean ppc_elf_relocate_section PARAMS ((bfd *,
  26921. +                         struct bfd_link_info *info,
  26922. +                         bfd *,
  26923. +                         asection *,
  26924. +                         bfd_byte *,
  26925. +                         Elf_Internal_Rela *relocs,
  26926. +                         Elf_Internal_Sym *local_syms,
  26927. +                         asection **));
  26928. +
  26929. +static boolean ppc_elf_add_symbol_hook  PARAMS ((bfd *,
  26930. +                         struct bfd_link_info *,
  26931. +                         const Elf_Internal_Sym *,
  26932. +                         const char **,
  26933. +                         flagword *,
  26934. +                         asection **,
  26935. +                         bfd_vma *));
  26936. +
  26937. +static boolean ppc_elf_finish_dynamic_symbol PARAMS ((bfd *,
  26938. +                              struct bfd_link_info *,
  26939. +                              struct elf_link_hash_entry *,
  26940. +                              Elf_Internal_Sym *));
  26941. +
  26942. +static boolean ppc_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
  26943. +static enum elf_reloc_type_class ppc_elf_reloc_type_class
  26944. +  PARAMS ((const Elf_Internal_Rela *));
  26945. +static boolean ppc_elf_grok_prstatus
  26946. +  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
  26947. +static boolean ppc_elf_grok_psinfo
  26948. +  PARAMS ((bfd *abfd, Elf_Internal_Note *note));
  26949. +
  26950. +#define BRANCH_PREDICT_BIT 0x200000        /* branch prediction bit for branch taken relocs */
  26951. +#define RA_REGISTER_MASK 0x001f0000        /* mask to set RA in memory instructions */
  26952. +#define RA_REGISTER_SHIFT 16            /* value to shift register by to insert RA */
  26953. +
  26954. +/* The name of the dynamic interpreter.  This is put in the .interp
  26955. +   section.  */
  26956. +
  26957. +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
  26958. +
  26959. +/* The size in bytes of an entry in the procedure linkage table.  */
  26960. +#define PLT_ENTRY_SIZE 12
  26961. +/* The initial size of the plt reserved for the dynamic linker.  */
  26962. +#define PLT_INITIAL_ENTRY_SIZE 72
  26963. +/* The size of the gap between entries in the PLT.  */
  26964. +#define PLT_SLOT_SIZE 8
  26965. +/* The number of single-slot PLT entries (the rest use two slots).  */
  26966. +#define PLT_NUM_SINGLE_ENTRIES 8192
  26967. +
  26968. +/* Will references to this symbol always reference the symbol
  26969. +   in this object?  */
  26970. +#define SYMBOL_REFERENCES_LOCAL(INFO, H)                \
  26971. +  ((! INFO->shared                            \
  26972. +    || INFO->symbolic                            \
  26973. +    || H->dynindx == -1                            \
  26974. +    || ELF_ST_VISIBILITY (H->other) == STV_INTERNAL            \
  26975. +    || ELF_ST_VISIBILITY (H->other) == STV_HIDDEN)            \
  26976. +   && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
  26977. +
  26978. +/* Will _calls_ to this symbol always call the version in this object?  */
  26979. +#define SYMBOL_CALLS_LOCAL(INFO, H)                \
  26980. +  ((! INFO->shared                            \
  26981. +    || INFO->symbolic                            \
  26982. +    || H->dynindx == -1                            \
  26983. +    || ELF_ST_VISIBILITY (H->other) != STV_DEFAULT)            \
  26984. +   && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
  26985. +
  26986. +static reloc_howto_type *ppc_elf_howto_table[(int) R_PPC_max];
  26987. +
  26988. +static reloc_howto_type ppc_elf_howto_raw[] = {
  26989. +  /* This reloc does nothing.  */
  26990. +  HOWTO (R_PPC_NONE,        /* type */
  26991. +     0,            /* rightshift */
  26992. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  26993. +     32,            /* bitsize */
  26994. +     false,            /* pc_relative */
  26995. +     0,            /* bitpos */
  26996. +     complain_overflow_bitfield, /* complain_on_overflow */
  26997. +     bfd_elf_generic_reloc,    /* special_function */
  26998. +     "R_PPC_NONE",        /* name */
  26999. +     false,            /* partial_inplace */
  27000. +     0,            /* src_mask */
  27001. +     0,            /* dst_mask */
  27002. +     false),        /* pcrel_offset */
  27003. +
  27004. +  /* A standard 32 bit relocation.  */
  27005. +  HOWTO (R_PPC_ADDR32,        /* type */
  27006. +     0,            /* rightshift */
  27007. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27008. +     32,            /* bitsize */
  27009. +     false,            /* pc_relative */
  27010. +     0,            /* bitpos */
  27011. +     complain_overflow_bitfield, /* complain_on_overflow */
  27012. +     bfd_elf_generic_reloc,    /* special_function */
  27013. +     "R_PPC_ADDR32",    /* name */
  27014. +     false,            /* partial_inplace */
  27015. +     0,            /* src_mask */
  27016. +     0xffffffff,        /* dst_mask */
  27017. +     false),        /* pcrel_offset */
  27018. +
  27019. +  /* An absolute 26 bit branch; the lower two bits must be zero.
  27020. +     FIXME: we don't check that, we just clear them.  */
  27021. +  HOWTO (R_PPC_ADDR24,        /* type */
  27022. +     0,            /* rightshift */
  27023. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27024. +     26,            /* bitsize */
  27025. +     false,            /* pc_relative */
  27026. +     0,            /* bitpos */
  27027. +     complain_overflow_bitfield, /* complain_on_overflow */
  27028. +     bfd_elf_generic_reloc,    /* special_function */
  27029. +     "R_PPC_ADDR24",    /* name */
  27030. +     false,            /* partial_inplace */
  27031. +     0,            /* src_mask */
  27032. +     0x3fffffc,        /* dst_mask */
  27033. +     false),        /* pcrel_offset */
  27034. +
  27035. +  /* A standard 16 bit relocation.  */
  27036. +  HOWTO (R_PPC_ADDR16,        /* type */
  27037. +     0,            /* rightshift */
  27038. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27039. +     16,            /* bitsize */
  27040. +     false,            /* pc_relative */
  27041. +     0,            /* bitpos */
  27042. +     complain_overflow_bitfield, /* complain_on_overflow */
  27043. +     bfd_elf_generic_reloc,    /* special_function */
  27044. +     "R_PPC_ADDR16",    /* name */
  27045. +     false,            /* partial_inplace */
  27046. +     0,            /* src_mask */
  27047. +     0xffff,        /* dst_mask */
  27048. +     false),        /* pcrel_offset */
  27049. +
  27050. +  /* A 16 bit relocation without overflow.  */
  27051. +  HOWTO (R_PPC_ADDR16_LO,    /* type */
  27052. +     0,            /* rightshift */
  27053. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27054. +     16,            /* bitsize */
  27055. +     false,            /* pc_relative */
  27056. +     0,            /* bitpos */
  27057. +     complain_overflow_dont,/* complain_on_overflow */
  27058. +     bfd_elf_generic_reloc,    /* special_function */
  27059. +     "R_PPC_ADDR16_LO",    /* name */
  27060. +     false,            /* partial_inplace */
  27061. +     0,            /* src_mask */
  27062. +     0xffff,        /* dst_mask */
  27063. +     false),        /* pcrel_offset */
  27064. +
  27065. +  /* The high order 16 bits of an address.  */
  27066. +  HOWTO (R_PPC_ADDR16_HI,    /* type */
  27067. +     16,            /* rightshift */
  27068. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27069. +     16,            /* bitsize */
  27070. +     false,            /* pc_relative */
  27071. +     0,            /* bitpos */
  27072. +     complain_overflow_dont, /* complain_on_overflow */
  27073. +     bfd_elf_generic_reloc,    /* special_function */
  27074. +     "R_PPC_ADDR16_HI",    /* name */
  27075. +     false,            /* partial_inplace */
  27076. +     0,            /* src_mask */
  27077. +     0xffff,        /* dst_mask */
  27078. +     false),        /* pcrel_offset */
  27079. +
  27080. +  /* The high order 16 bits of an address, plus 1 if the contents of
  27081. +     the low 16 bits, treated as a signed number, is negative.  */
  27082. +  HOWTO (R_PPC_ADDR16_HA,    /* type */
  27083. +     16,            /* rightshift */
  27084. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27085. +     16,            /* bitsize */
  27086. +     false,            /* pc_relative */
  27087. +     0,            /* bitpos */
  27088. +     complain_overflow_dont, /* complain_on_overflow */
  27089. +     ppc_elf_addr16_ha_reloc, /* special_function */
  27090. +     "R_PPC_ADDR16_HA",    /* name */
  27091. +     false,            /* partial_inplace */
  27092. +     0,            /* src_mask */
  27093. +     0xffff,        /* dst_mask */
  27094. +     false),        /* pcrel_offset */
  27095. +
  27096. +  /* An absolute 16 bit branch; the lower two bits must be zero.
  27097. +     FIXME: we don't check that, we just clear them.  */
  27098. +  HOWTO (R_PPC_ADDR14,        /* type */
  27099. +     0,            /* rightshift */
  27100. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27101. +     16,            /* bitsize */
  27102. +     false,            /* pc_relative */
  27103. +     0,            /* bitpos */
  27104. +     complain_overflow_bitfield, /* complain_on_overflow */
  27105. +     bfd_elf_generic_reloc,    /* special_function */
  27106. +     "R_PPC_ADDR14",    /* name */
  27107. +     false,            /* partial_inplace */
  27108. +     0,            /* src_mask */
  27109. +     0xfffc,        /* dst_mask */
  27110. +     false),        /* pcrel_offset */
  27111. +
  27112. +  /* An absolute 16 bit branch, for which bit 10 should be set to
  27113. +     indicate that the branch is expected to be taken.    The lower two
  27114. +     bits must be zero.  */
  27115. +  HOWTO (R_PPC_ADDR14_BRTAKEN,    /* type */
  27116. +     0,            /* rightshift */
  27117. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27118. +     16,            /* bitsize */
  27119. +     false,            /* pc_relative */
  27120. +     0,            /* bitpos */
  27121. +     complain_overflow_bitfield, /* complain_on_overflow */
  27122. +     bfd_elf_generic_reloc,    /* special_function */
  27123. +     "R_PPC_ADDR14_BRTAKEN",/* name */
  27124. +     false,            /* partial_inplace */
  27125. +     0,            /* src_mask */
  27126. +     0xfffc,        /* dst_mask */
  27127. +     false),        /* pcrel_offset */
  27128. +
  27129. +  /* An absolute 16 bit branch, for which bit 10 should be set to
  27130. +     indicate that the branch is not expected to be taken.  The lower
  27131. +     two bits must be zero.  */
  27132. +  HOWTO (R_PPC_ADDR14_BRNTAKEN, /* type */
  27133. +     0,            /* rightshift */
  27134. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27135. +     16,            /* bitsize */
  27136. +     false,            /* pc_relative */
  27137. +     0,            /* bitpos */
  27138. +     complain_overflow_bitfield, /* complain_on_overflow */
  27139. +     bfd_elf_generic_reloc,    /* special_function */
  27140. +     "R_PPC_ADDR14_BRNTAKEN",/* name */
  27141. +     false,            /* partial_inplace */
  27142. +     0,            /* src_mask */
  27143. +     0xfffc,        /* dst_mask */
  27144. +     false),        /* pcrel_offset */
  27145. +
  27146. +  /* A relative 26 bit branch; the lower two bits must be zero.  */
  27147. +  HOWTO (R_PPC_REL24,        /* type */
  27148. +     0,            /* rightshift */
  27149. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27150. +     26,            /* bitsize */
  27151. +     true,            /* pc_relative */
  27152. +     0,            /* bitpos */
  27153. +     complain_overflow_signed, /* complain_on_overflow */
  27154. +     bfd_elf_generic_reloc,    /* special_function */
  27155. +     "R_PPC_REL24",        /* name */
  27156. +     false,            /* partial_inplace */
  27157. +     0,            /* src_mask */
  27158. +     0x3fffffc,        /* dst_mask */
  27159. +     true),            /* pcrel_offset */
  27160. +
  27161. +  /* A relative 16 bit branch; the lower two bits must be zero.  */
  27162. +  HOWTO (R_PPC_REL14,        /* type */
  27163. +     0,            /* rightshift */
  27164. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27165. +     16,            /* bitsize */
  27166. +     true,            /* pc_relative */
  27167. +     0,            /* bitpos */
  27168. +     complain_overflow_signed, /* complain_on_overflow */
  27169. +     bfd_elf_generic_reloc,    /* special_function */
  27170. +     "R_PPC_REL14",        /* name */
  27171. +     false,            /* partial_inplace */
  27172. +     0,            /* src_mask */
  27173. +     0xfffc,        /* dst_mask */
  27174. +     true),            /* pcrel_offset */
  27175. +
  27176. +  /* A relative 16 bit branch.  Bit 10 should be set to indicate that
  27177. +     the branch is expected to be taken.  The lower two bits must be
  27178. +     zero.  */
  27179. +  HOWTO (R_PPC_REL14_BRTAKEN,    /* type */
  27180. +     0,            /* rightshift */
  27181. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27182. +     16,            /* bitsize */
  27183. +     true,            /* pc_relative */
  27184. +     0,            /* bitpos */
  27185. +     complain_overflow_signed, /* complain_on_overflow */
  27186. +     bfd_elf_generic_reloc,    /* special_function */
  27187. +     "R_PPC_REL14_BRTAKEN",    /* name */
  27188. +     false,            /* partial_inplace */
  27189. +     0,            /* src_mask */
  27190. +     0xfffc,        /* dst_mask */
  27191. +     true),            /* pcrel_offset */
  27192. +
  27193. +  /* A relative 16 bit branch.  Bit 10 should be set to indicate that
  27194. +     the branch is not expected to be taken.  The lower two bits must
  27195. +     be zero.  */
  27196. +  HOWTO (R_PPC_REL14_BRNTAKEN,    /* type */
  27197. +     0,            /* rightshift */
  27198. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27199. +     16,            /* bitsize */
  27200. +     true,            /* pc_relative */
  27201. +     0,            /* bitpos */
  27202. +     complain_overflow_signed, /* complain_on_overflow */
  27203. +     bfd_elf_generic_reloc,    /* special_function */
  27204. +     "R_PPC_REL14_BRNTAKEN",/* name */
  27205. +     false,            /* partial_inplace */
  27206. +     0,            /* src_mask */
  27207. +     0xfffc,        /* dst_mask */
  27208. +     true),            /* pcrel_offset */
  27209. +
  27210. +  /* Like R_PPC_ADDR16, but referring to the GOT table entry for the
  27211. +     symbol.  */
  27212. +  HOWTO (R_PPC_GOT16,        /* type */
  27213. +     0,            /* rightshift */
  27214. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27215. +     16,            /* bitsize */
  27216. +     false,            /* pc_relative */
  27217. +     0,            /* bitpos */
  27218. +     complain_overflow_signed, /* complain_on_overflow */
  27219. +     bfd_elf_generic_reloc,    /* special_function */
  27220. +     "R_PPC_GOT16",        /* name */
  27221. +     false,            /* partial_inplace */
  27222. +     0,            /* src_mask */
  27223. +     0xffff,        /* dst_mask */
  27224. +     false),        /* pcrel_offset */
  27225. +
  27226. +  /* Like R_PPC_ADDR16_LO, but referring to the GOT table entry for
  27227. +     the symbol.  */
  27228. +  HOWTO (R_PPC_GOT16_LO,    /* type */
  27229. +     0,            /* rightshift */
  27230. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27231. +     16,            /* bitsize */
  27232. +     false,            /* pc_relative */
  27233. +     0,            /* bitpos */
  27234. +     complain_overflow_dont, /* complain_on_overflow */
  27235. +     bfd_elf_generic_reloc,    /* special_function */
  27236. +     "R_PPC_GOT16_LO",    /* name */
  27237. +     false,            /* partial_inplace */
  27238. +     0,            /* src_mask */
  27239. +     0xffff,        /* dst_mask */
  27240. +     false),        /* pcrel_offset */
  27241. +
  27242. +  /* Like R_PPC_ADDR16_HI, but referring to the GOT table entry for
  27243. +     the symbol.  */
  27244. +  HOWTO (R_PPC_GOT16_HI,    /* type */
  27245. +     16,            /* rightshift */
  27246. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27247. +     16,            /* bitsize */
  27248. +     false,            /* pc_relative */
  27249. +     0,            /* bitpos */
  27250. +     complain_overflow_bitfield, /* complain_on_overflow */
  27251. +     bfd_elf_generic_reloc,    /* special_function */
  27252. +     "R_PPC_GOT16_HI",    /* name */
  27253. +     false,            /* partial_inplace */
  27254. +     0,            /* src_mask */
  27255. +     0xffff,        /* dst_mask */
  27256. +     false),         /* pcrel_offset */
  27257. +
  27258. +  /* Like R_PPC_ADDR16_HA, but referring to the GOT table entry for
  27259. +     the symbol.  */
  27260. +  HOWTO (R_PPC_GOT16_HA,    /* type */
  27261. +     16,            /* rightshift */
  27262. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27263. +     16,            /* bitsize */
  27264. +     false,            /* pc_relative */
  27265. +     0,            /* bitpos */
  27266. +     complain_overflow_bitfield, /* complain_on_overflow */
  27267. +     ppc_elf_addr16_ha_reloc, /* special_function */
  27268. +     "R_PPC_GOT16_HA",    /* name */
  27269. +     false,            /* partial_inplace */
  27270. +     0,            /* src_mask */
  27271. +     0xffff,        /* dst_mask */
  27272. +     false),        /* pcrel_offset */
  27273. +
  27274. +  /* Like R_PPC_REL24, but referring to the procedure linkage table
  27275. +     entry for the symbol.  */
  27276. +  HOWTO (R_PPC_PLTREL24,    /* type */
  27277. +     0,            /* rightshift */
  27278. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27279. +     26,            /* bitsize */
  27280. +     true,            /* pc_relative */
  27281. +     0,            /* bitpos */
  27282. +     complain_overflow_signed,  /* complain_on_overflow */
  27283. +     bfd_elf_generic_reloc,    /* special_function */
  27284. +     "R_PPC_PLTREL24",    /* name */
  27285. +     false,            /* partial_inplace */
  27286. +     0,            /* src_mask */
  27287. +     0x3fffffc,        /* dst_mask */
  27288. +     true),            /* pcrel_offset */
  27289. +
  27290. +  /* This is used only by the dynamic linker.  The symbol should exist
  27291. +     both in the object being run and in some shared library.  The
  27292. +     dynamic linker copies the data addressed by the symbol from the
  27293. +     shared library into the object, because the object being
  27294. +     run has to have the data at some particular address.  */
  27295. +  HOWTO (R_PPC_COPY,        /* type */
  27296. +     0,            /* rightshift */
  27297. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27298. +     32,            /* bitsize */
  27299. +     false,            /* pc_relative */
  27300. +     0,            /* bitpos */
  27301. +     complain_overflow_bitfield, /* complain_on_overflow */
  27302. +     bfd_elf_generic_reloc,     /* special_function */
  27303. +     "R_PPC_COPY",        /* name */
  27304. +     false,            /* partial_inplace */
  27305. +     0,            /* src_mask */
  27306. +     0,            /* dst_mask */
  27307. +     false),        /* pcrel_offset */
  27308. +
  27309. +  /* Like R_PPC_ADDR32, but used when setting global offset table
  27310. +     entries.  */
  27311. +  HOWTO (R_PPC_GLOB_DAT,    /* type */
  27312. +     0,            /* rightshift */
  27313. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27314. +     32,            /* bitsize */
  27315. +     false,            /* pc_relative */
  27316. +     0,            /* bitpos */
  27317. +     complain_overflow_bitfield, /* complain_on_overflow */
  27318. +     bfd_elf_generic_reloc,     /* special_function */
  27319. +     "R_PPC_GLOB_DAT",    /* name */
  27320. +     false,            /* partial_inplace */
  27321. +     0,            /* src_mask */
  27322. +     0xffffffff,        /* dst_mask */
  27323. +     false),        /* pcrel_offset */
  27324. +
  27325. +  /* Marks a procedure linkage table entry for a symbol.  */
  27326. +  HOWTO (R_PPC_JMP_SLOT,    /* type */
  27327. +     0,            /* rightshift */
  27328. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27329. +     32,            /* bitsize */
  27330. +     false,            /* pc_relative */
  27331. +     0,            /* bitpos */
  27332. +     complain_overflow_bitfield, /* complain_on_overflow */
  27333. +     bfd_elf_generic_reloc,     /* special_function */
  27334. +     "R_PPC_JMP_SLOT",    /* name */
  27335. +     false,            /* partial_inplace */
  27336. +     0,            /* src_mask */
  27337. +     0,            /* dst_mask */
  27338. +     false),        /* pcrel_offset */
  27339. +
  27340. +  /* Used only by the dynamic linker.  When the object is run, this
  27341. +     longword is set to the load address of the object, plus the
  27342. +     addend.  */
  27343. +  HOWTO (R_PPC_RELATIVE,    /* type */
  27344. +     0,            /* rightshift */
  27345. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27346. +     32,            /* bitsize */
  27347. +     false,            /* pc_relative */
  27348. +     0,            /* bitpos */
  27349. +     complain_overflow_bitfield, /* complain_on_overflow */
  27350. +     bfd_elf_generic_reloc,     /* special_function */
  27351. +     "R_PPC_RELATIVE",    /* name */
  27352. +     false,            /* partial_inplace */
  27353. +     0,            /* src_mask */
  27354. +     0xffffffff,        /* dst_mask */
  27355. +     false),        /* pcrel_offset */
  27356. +
  27357. +  /* Like R_PPC_REL24, but uses the value of the symbol within the
  27358. +     object rather than the final value.  Normally used for
  27359. +     _GLOBAL_OFFSET_TABLE_.  */
  27360. +  HOWTO (R_PPC_LOCAL24PC,    /* type */
  27361. +     0,            /* rightshift */
  27362. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27363. +     26,            /* bitsize */
  27364. +     true,            /* pc_relative */
  27365. +     0,            /* bitpos */
  27366. +     complain_overflow_signed, /* complain_on_overflow */
  27367. +     bfd_elf_generic_reloc,    /* special_function */
  27368. +     "R_PPC_LOCAL24PC",    /* name */
  27369. +     false,            /* partial_inplace */
  27370. +     0,            /* src_mask */
  27371. +     0x3fffffc,        /* dst_mask */
  27372. +     true),            /* pcrel_offset */
  27373. +
  27374. +  /* Like R_PPC_ADDR32, but may be unaligned.  */
  27375. +  HOWTO (R_PPC_UADDR32,        /* type */
  27376. +     0,            /* rightshift */
  27377. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27378. +     32,            /* bitsize */
  27379. +     false,            /* pc_relative */
  27380. +     0,            /* bitpos */
  27381. +     complain_overflow_bitfield, /* complain_on_overflow */
  27382. +     bfd_elf_generic_reloc,    /* special_function */
  27383. +     "R_PPC_UADDR32",    /* name */
  27384. +     false,            /* partial_inplace */
  27385. +     0,            /* src_mask */
  27386. +     0xffffffff,        /* dst_mask */
  27387. +     false),        /* pcrel_offset */
  27388. +
  27389. +  /* Like R_PPC_ADDR16, but may be unaligned.  */
  27390. +  HOWTO (R_PPC_UADDR16,        /* type */
  27391. +     0,            /* rightshift */
  27392. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27393. +     16,            /* bitsize */
  27394. +     false,            /* pc_relative */
  27395. +     0,            /* bitpos */
  27396. +     complain_overflow_bitfield, /* complain_on_overflow */
  27397. +     bfd_elf_generic_reloc,    /* special_function */
  27398. +     "R_PPC_UADDR16",    /* name */
  27399. +     false,            /* partial_inplace */
  27400. +     0,            /* src_mask */
  27401. +     0xffff,        /* dst_mask */
  27402. +     false),        /* pcrel_offset */
  27403. +
  27404. +  /* 32-bit PC relative */
  27405. +  HOWTO (R_PPC_REL32,        /* type */
  27406. +     0,            /* rightshift */
  27407. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27408. +     32,            /* bitsize */
  27409. +     true,            /* pc_relative */
  27410. +     0,            /* bitpos */
  27411. +     complain_overflow_bitfield, /* complain_on_overflow */
  27412. +     bfd_elf_generic_reloc,    /* special_function */
  27413. +     "R_PPC_REL32",        /* name */
  27414. +     false,            /* partial_inplace */
  27415. +     0,            /* src_mask */
  27416. +     0xffffffff,        /* dst_mask */
  27417. +     true),            /* pcrel_offset */
  27418. +
  27419. +  /* 32-bit relocation to the symbol's procedure linkage table.
  27420. +     FIXME: not supported.  */
  27421. +  HOWTO (R_PPC_PLT32,        /* type */
  27422. +     0,            /* rightshift */
  27423. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27424. +     32,            /* bitsize */
  27425. +     false,            /* pc_relative */
  27426. +     0,            /* bitpos */
  27427. +     complain_overflow_bitfield, /* complain_on_overflow */
  27428. +     bfd_elf_generic_reloc,    /* special_function */
  27429. +     "R_PPC_PLT32",        /* name */
  27430. +     false,            /* partial_inplace */
  27431. +     0,            /* src_mask */
  27432. +     0,            /* dst_mask */
  27433. +     false),        /* pcrel_offset */
  27434. +
  27435. +  /* 32-bit PC relative relocation to the symbol's procedure linkage table.
  27436. +     FIXME: not supported.  */
  27437. +  HOWTO (R_PPC_PLTREL32,    /* type */
  27438. +     0,            /* rightshift */
  27439. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27440. +     32,            /* bitsize */
  27441. +     true,            /* pc_relative */
  27442. +     0,            /* bitpos */
  27443. +     complain_overflow_bitfield, /* complain_on_overflow */
  27444. +     bfd_elf_generic_reloc,    /* special_function */
  27445. +     "R_PPC_PLTREL32",    /* name */
  27446. +     false,            /* partial_inplace */
  27447. +     0,            /* src_mask */
  27448. +     0,            /* dst_mask */
  27449. +     true),            /* pcrel_offset */
  27450. +
  27451. +  /* Like R_PPC_ADDR16_LO, but referring to the PLT table entry for
  27452. +     the symbol.  */
  27453. +  HOWTO (R_PPC_PLT16_LO,    /* type */
  27454. +     0,            /* rightshift */
  27455. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27456. +     16,            /* bitsize */
  27457. +     false,            /* pc_relative */
  27458. +     0,            /* bitpos */
  27459. +     complain_overflow_dont, /* complain_on_overflow */
  27460. +     bfd_elf_generic_reloc,    /* special_function */
  27461. +     "R_PPC_PLT16_LO",    /* name */
  27462. +     false,            /* partial_inplace */
  27463. +     0,            /* src_mask */
  27464. +     0xffff,        /* dst_mask */
  27465. +     false),        /* pcrel_offset */
  27466. +
  27467. +  /* Like R_PPC_ADDR16_HI, but referring to the PLT table entry for
  27468. +     the symbol.  */
  27469. +  HOWTO (R_PPC_PLT16_HI,    /* type */
  27470. +     16,            /* rightshift */
  27471. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27472. +     16,            /* bitsize */
  27473. +     false,            /* pc_relative */
  27474. +     0,            /* bitpos */
  27475. +     complain_overflow_bitfield, /* complain_on_overflow */
  27476. +     bfd_elf_generic_reloc,    /* special_function */
  27477. +     "R_PPC_PLT16_HI",    /* name */
  27478. +     false,            /* partial_inplace */
  27479. +     0,            /* src_mask */
  27480. +     0xffff,        /* dst_mask */
  27481. +     false),         /* pcrel_offset */
  27482. +
  27483. +  /* Like R_PPC_ADDR16_HA, but referring to the PLT table entry for
  27484. +     the symbol.  */
  27485. +  HOWTO (R_PPC_PLT16_HA,    /* type */
  27486. +     16,            /* rightshift */
  27487. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27488. +     16,            /* bitsize */
  27489. +     false,            /* pc_relative */
  27490. +     0,            /* bitpos */
  27491. +     complain_overflow_bitfield, /* complain_on_overflow */
  27492. +     ppc_elf_addr16_ha_reloc, /* special_function */
  27493. +     "R_PPC_PLT16_HA",    /* name */
  27494. +     false,            /* partial_inplace */
  27495. +     0,            /* src_mask */
  27496. +     0xffff,        /* dst_mask */
  27497. +     false),        /* pcrel_offset */
  27498. +
  27499. +  /* A sign-extended 16 bit value relative to _SDA_BASE_, for use with
  27500. +     small data items.  */
  27501. +  HOWTO (R_PPC_SDAREL16,    /* type */
  27502. +     0,            /* rightshift */
  27503. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27504. +     16,            /* bitsize */
  27505. +     false,            /* pc_relative */
  27506. +     0,            /* bitpos */
  27507. +     complain_overflow_signed, /* complain_on_overflow */
  27508. +     bfd_elf_generic_reloc,    /* special_function */
  27509. +     "R_PPC_SDAREL16",    /* name */
  27510. +     false,            /* partial_inplace */
  27511. +     0,            /* src_mask */
  27512. +     0xffff,        /* dst_mask */
  27513. +     false),        /* pcrel_offset */
  27514. +
  27515. +  /* 16-bit section relative relocation.  */
  27516. +  HOWTO (R_PPC_SECTOFF,        /* type */
  27517. +     0,            /* rightshift */
  27518. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27519. +     16,            /* bitsize */
  27520. +     false,            /* pc_relative */
  27521. +     0,            /* bitpos */
  27522. +     complain_overflow_bitfield, /* complain_on_overflow */
  27523. +     bfd_elf_generic_reloc,    /* special_function */
  27524. +     "R_PPC_SECTOFF",    /* name */
  27525. +     false,            /* partial_inplace */
  27526. +     0,            /* src_mask */
  27527. +     0xffff,        /* dst_mask */
  27528. +     false),        /* pcrel_offset */
  27529. +
  27530. +  /* 16-bit lower half section relative relocation.  */
  27531. +  HOWTO (R_PPC_SECTOFF_LO,      /* type */
  27532. +     0,            /* rightshift */
  27533. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27534. +     16,            /* bitsize */
  27535. +     false,            /* pc_relative */
  27536. +     0,            /* bitpos */
  27537. +     complain_overflow_dont, /* complain_on_overflow */
  27538. +     bfd_elf_generic_reloc,    /* special_function */
  27539. +     "R_PPC_SECTOFF_LO",    /* name */
  27540. +     false,            /* partial_inplace */
  27541. +     0,            /* src_mask */
  27542. +     0xffff,        /* dst_mask */
  27543. +     false),        /* pcrel_offset */
  27544. +
  27545. +  /* 16-bit upper half section relative relocation.  */
  27546. +  HOWTO (R_PPC_SECTOFF_HI,    /* type */
  27547. +     16,            /* rightshift */
  27548. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27549. +     16,            /* bitsize */
  27550. +     false,            /* pc_relative */
  27551. +     0,            /* bitpos */
  27552. +     complain_overflow_bitfield, /* complain_on_overflow */
  27553. +     bfd_elf_generic_reloc,    /* special_function */
  27554. +     "R_PPC_SECTOFF_HI",    /* name */
  27555. +     false,            /* partial_inplace */
  27556. +     0,            /* src_mask */
  27557. +     0xffff,        /* dst_mask */
  27558. +     false),         /* pcrel_offset */
  27559. +
  27560. +  /* 16-bit upper half adjusted section relative relocation.  */
  27561. +  HOWTO (R_PPC_SECTOFF_HA,    /* type */
  27562. +     16,            /* rightshift */
  27563. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27564. +     16,            /* bitsize */
  27565. +     false,            /* pc_relative */
  27566. +     0,            /* bitpos */
  27567. +     complain_overflow_bitfield, /* complain_on_overflow */
  27568. +     ppc_elf_addr16_ha_reloc, /* special_function */
  27569. +     "R_PPC_SECTOFF_HA",    /* name */
  27570. +     false,            /* partial_inplace */
  27571. +     0,            /* src_mask */
  27572. +     0xffff,        /* dst_mask */
  27573. +     false),        /* pcrel_offset */
  27574. +
  27575. +  /* The remaining relocs are from the Embedded ELF ABI, and are not
  27576. +     in the SVR4 ELF ABI.  */
  27577. +
  27578. +  /* 32 bit value resulting from the addend minus the symbol */
  27579. +  HOWTO (R_PPC_EMB_NADDR32,    /* type */
  27580. +     0,            /* rightshift */
  27581. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27582. +     32,            /* bitsize */
  27583. +     false,            /* pc_relative */
  27584. +     0,            /* bitpos */
  27585. +     complain_overflow_bitfield, /* complain_on_overflow */
  27586. +     bfd_elf_generic_reloc,    /* special_function */
  27587. +     "R_PPC_EMB_NADDR32",    /* name */
  27588. +     false,            /* partial_inplace */
  27589. +     0,            /* src_mask */
  27590. +     0xffffffff,        /* dst_mask */
  27591. +     false),        /* pcrel_offset */
  27592. +
  27593. +  /* 16 bit value resulting from the addend minus the symbol */
  27594. +  HOWTO (R_PPC_EMB_NADDR16,    /* type */
  27595. +     0,            /* rightshift */
  27596. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27597. +     16,            /* bitsize */
  27598. +     false,            /* pc_relative */
  27599. +     0,            /* bitpos */
  27600. +     complain_overflow_bitfield, /* complain_on_overflow */
  27601. +     bfd_elf_generic_reloc,    /* special_function */
  27602. +     "R_PPC_EMB_NADDR16",    /* name */
  27603. +     false,            /* partial_inplace */
  27604. +     0,            /* src_mask */
  27605. +     0xffff,        /* dst_mask */
  27606. +     false),        /* pcrel_offset */
  27607. +
  27608. +  /* 16 bit value resulting from the addend minus the symbol */
  27609. +  HOWTO (R_PPC_EMB_NADDR16_LO,    /* type */
  27610. +     0,            /* rightshift */
  27611. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27612. +     16,            /* bitsize */
  27613. +     false,            /* pc_relative */
  27614. +     0,            /* bitpos */
  27615. +     complain_overflow_dont,/* complain_on_overflow */
  27616. +     bfd_elf_generic_reloc,    /* special_function */
  27617. +     "R_PPC_EMB_ADDR16_LO",    /* name */
  27618. +     false,            /* partial_inplace */
  27619. +     0,            /* src_mask */
  27620. +     0xffff,        /* dst_mask */
  27621. +     false),        /* pcrel_offset */
  27622. +
  27623. +  /* The high order 16 bits of the addend minus the symbol */
  27624. +  HOWTO (R_PPC_EMB_NADDR16_HI,    /* type */
  27625. +     16,            /* rightshift */
  27626. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27627. +     16,            /* bitsize */
  27628. +     false,            /* pc_relative */
  27629. +     0,            /* bitpos */
  27630. +     complain_overflow_dont, /* complain_on_overflow */
  27631. +     bfd_elf_generic_reloc,    /* special_function */
  27632. +     "R_PPC_EMB_NADDR16_HI", /* name */
  27633. +     false,            /* partial_inplace */
  27634. +     0,            /* src_mask */
  27635. +     0xffff,        /* dst_mask */
  27636. +     false),        /* pcrel_offset */
  27637. +
  27638. +  /* The high order 16 bits of the result of the addend minus the address,
  27639. +     plus 1 if the contents of the low 16 bits, treated as a signed number,
  27640. +     is negative.  */
  27641. +  HOWTO (R_PPC_EMB_NADDR16_HA,    /* type */
  27642. +     16,            /* rightshift */
  27643. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27644. +     16,            /* bitsize */
  27645. +     false,            /* pc_relative */
  27646. +     0,            /* bitpos */
  27647. +     complain_overflow_dont, /* complain_on_overflow */
  27648. +     ppc_elf_addr16_ha_reloc, /* special_function */
  27649. +     "R_PPC_EMB_NADDR16_HA", /* name */
  27650. +     false,            /* partial_inplace */
  27651. +     0,            /* src_mask */
  27652. +     0xffff,        /* dst_mask */
  27653. +     false),        /* pcrel_offset */
  27654. +
  27655. +  /* 16 bit value resulting from allocating a 4 byte word to hold an
  27656. +     address in the .sdata section, and returning the offset from
  27657. +     _SDA_BASE_ for that relocation */
  27658. +  HOWTO (R_PPC_EMB_SDAI16,    /* type */
  27659. +     0,            /* rightshift */
  27660. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27661. +     16,            /* bitsize */
  27662. +     false,            /* pc_relative */
  27663. +     0,            /* bitpos */
  27664. +     complain_overflow_bitfield, /* complain_on_overflow */
  27665. +     bfd_elf_generic_reloc,    /* special_function */
  27666. +     "R_PPC_EMB_SDAI16",    /* name */
  27667. +     false,            /* partial_inplace */
  27668. +     0,            /* src_mask */
  27669. +     0xffff,        /* dst_mask */
  27670. +     false),        /* pcrel_offset */
  27671. +
  27672. +  /* 16 bit value resulting from allocating a 4 byte word to hold an
  27673. +     address in the .sdata2 section, and returning the offset from
  27674. +     _SDA2_BASE_ for that relocation */
  27675. +  HOWTO (R_PPC_EMB_SDA2I16,    /* type */
  27676. +     0,            /* rightshift */
  27677. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27678. +     16,            /* bitsize */
  27679. +     false,            /* pc_relative */
  27680. +     0,            /* bitpos */
  27681. +     complain_overflow_bitfield, /* complain_on_overflow */
  27682. +     bfd_elf_generic_reloc,    /* special_function */
  27683. +     "R_PPC_EMB_SDA2I16",    /* name */
  27684. +     false,            /* partial_inplace */
  27685. +     0,            /* src_mask */
  27686. +     0xffff,        /* dst_mask */
  27687. +     false),        /* pcrel_offset */
  27688. +
  27689. +  /* A sign-extended 16 bit value relative to _SDA2_BASE_, for use with
  27690. +     small data items.     */
  27691. +  HOWTO (R_PPC_EMB_SDA2REL,    /* type */
  27692. +     0,            /* rightshift */
  27693. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27694. +     16,            /* bitsize */
  27695. +     false,            /* pc_relative */
  27696. +     0,            /* bitpos */
  27697. +     complain_overflow_signed, /* complain_on_overflow */
  27698. +     bfd_elf_generic_reloc,    /* special_function */
  27699. +     "R_PPC_EMB_SDA2REL",    /* name */
  27700. +     false,            /* partial_inplace */
  27701. +     0,            /* src_mask */
  27702. +     0xffff,        /* dst_mask */
  27703. +     false),        /* pcrel_offset */
  27704. +
  27705. +  /* Relocate against either _SDA_BASE_ or _SDA2_BASE_, filling in the 16 bit
  27706. +     signed offset from the appropriate base, and filling in the register
  27707. +     field with the appropriate register (0, 2, or 13).  */
  27708. +  HOWTO (R_PPC_EMB_SDA21,    /* type */
  27709. +     0,            /* rightshift */
  27710. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27711. +     16,            /* bitsize */
  27712. +     false,            /* pc_relative */
  27713. +     0,            /* bitpos */
  27714. +     complain_overflow_signed, /* complain_on_overflow */
  27715. +     bfd_elf_generic_reloc,    /* special_function */
  27716. +     "R_PPC_EMB_SDA21",    /* name */
  27717. +     false,            /* partial_inplace */
  27718. +     0,            /* src_mask */
  27719. +     0xffff,        /* dst_mask */
  27720. +     false),        /* pcrel_offset */
  27721. +
  27722. +  /* Relocation not handled: R_PPC_EMB_MRKREF */
  27723. +  /* Relocation not handled: R_PPC_EMB_RELSEC16 */
  27724. +  /* Relocation not handled: R_PPC_EMB_RELST_LO */
  27725. +  /* Relocation not handled: R_PPC_EMB_RELST_HI */
  27726. +  /* Relocation not handled: R_PPC_EMB_RELST_HA */
  27727. +  /* Relocation not handled: R_PPC_EMB_BIT_FLD */
  27728. +
  27729. +  /* PC relative relocation against either _SDA_BASE_ or _SDA2_BASE_, filling
  27730. +     in the 16 bit signed offset from the appropriate base, and filling in the
  27731. +     register field with the appropriate register (0, 2, or 13).  */
  27732. +  HOWTO (R_PPC_EMB_RELSDA,    /* type */
  27733. +     0,            /* rightshift */
  27734. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27735. +     16,            /* bitsize */
  27736. +     true,            /* pc_relative */
  27737. +     0,            /* bitpos */
  27738. +     complain_overflow_signed, /* complain_on_overflow */
  27739. +     bfd_elf_generic_reloc,    /* special_function */
  27740. +     "R_PPC_EMB_RELSDA",    /* name */
  27741. +     false,            /* partial_inplace */
  27742. +     0,            /* src_mask */
  27743. +     0xffff,        /* dst_mask */
  27744. +     false),        /* pcrel_offset */
  27745. +
  27746. +  /* GNU extension to record C++ vtable hierarchy */
  27747. +  HOWTO (R_PPC_GNU_VTINHERIT,    /* type */
  27748. +     0,            /* rightshift */
  27749. +     0,            /* size (0 = byte, 1 = short, 2 = long) */
  27750. +     0,            /* bitsize */
  27751. +     false,            /* pc_relative */
  27752. +     0,            /* bitpos */
  27753. +     complain_overflow_dont, /* complain_on_overflow */
  27754. +     NULL,            /* special_function */
  27755. +     "R_PPC_GNU_VTINHERIT",    /* name */
  27756. +     false,            /* partial_inplace */
  27757. +     0,            /* src_mask */
  27758. +     0,            /* dst_mask */
  27759. +     false),        /* pcrel_offset */
  27760. +
  27761. +  /* GNU extension to record C++ vtable member usage */
  27762. +  HOWTO (R_PPC_GNU_VTENTRY,    /* type */
  27763. +     0,            /* rightshift */
  27764. +     0,            /* size (0 = byte, 1 = short, 2 = long) */
  27765. +     0,            /* bitsize */
  27766. +     false,            /* pc_relative */
  27767. +     0,            /* bitpos */
  27768. +     complain_overflow_dont, /* complain_on_overflow */
  27769. +     NULL,            /* special_function */
  27770. +     "R_PPC_GNU_VTENTRY",    /* name */
  27771. +     false,            /* partial_inplace */
  27772. +     0,            /* src_mask */
  27773. +     0,            /* dst_mask */
  27774. +     false),        /* pcrel_offset */
  27775. +
  27776. +  /* Phony reloc to handle AIX style TOC entries */
  27777. +  HOWTO (R_PPC_TOC16,        /* type */
  27778. +     0,            /* rightshift */
  27779. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27780. +     16,            /* bitsize */
  27781. +     false,            /* pc_relative */
  27782. +     0,            /* bitpos */
  27783. +     complain_overflow_signed, /* complain_on_overflow */
  27784. +     bfd_elf_generic_reloc,    /* special_function */
  27785. +     "R_PPC_TOC16",        /* name */
  27786. +     false,            /* partial_inplace */
  27787. +     0,            /* src_mask */
  27788. +     0xffff,        /* dst_mask */
  27789. +     false),        /* pcrel_offset */
  27790. +
  27791. +  /* 32-bit relocation relative to _SDA_BASE_ */
  27792. +  HOWTO (R_PPC_MORPHOS_DREL,    /* type */
  27793. +     0,            /* rightshift */
  27794. +     2,            /* size (0 = byte, 1 = short, 2 = long) */
  27795. +     32,            /* bitsize */
  27796. +     false,            /* pc_relative */
  27797. +     0,            /* bitpos */
  27798. +     complain_overflow_bitfield, /* complain_on_overflow */
  27799. +     bfd_elf_generic_reloc,    /* special_function */
  27800. +     "R_PPC_MORPHOS_DREL",    /* name */
  27801. +     false,            /* partial_inplace */
  27802. +     0,            /* src_mask */
  27803. +     0,            /* dst_mask */
  27804. +     false),        /* pcrel_offset */
  27805. +
  27806. +  /* Lower 16 bits of a relocation relative to _SDA_BASE */
  27807. +  HOWTO (R_PPC_MORPHOS_DREL_LO,    /* type */
  27808. +     0,            /* rightshift */
  27809. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27810. +     16,            /* bitsize */
  27811. +     false,            /* pc_relative */
  27812. +     0,            /* bitpos */
  27813. +     complain_overflow_dont,/* complain_on_overflow */
  27814. +     /*complain_overflow_bitfield,*/ /* complain_on_overflow */
  27815. +     bfd_elf_generic_reloc,    /* special_function */
  27816. +     "R_PPC_MORPHOS_DREL_LO",/* name */
  27817. +     false,            /* partial_inplace */
  27818. +     0,            /* src_mask */
  27819. +     0xffff,        /* dst_mask */
  27820. +     false),        /* pcrel_offset */
  27821. +
  27822. +  /* Upper 16 bits of a relocation relative to _SDA_BASE */
  27823. +  HOWTO (R_PPC_MORPHOS_DREL_HI,    /* type */
  27824. +     16,            /* rightshift */
  27825. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27826. +     16,            /* bitsize */
  27827. +     false,            /* pc_relative */
  27828. +     0,            /* bitpos */
  27829. +     complain_overflow_dont,/* complain_on_overflow */
  27830. +     /*complain_overflow_bitfield,*/ /* complain_on_overflow */
  27831. +     bfd_elf_generic_reloc,    /* special_function */
  27832. +     "R_PPC_MORPHOS_DREL_HI",/* name */
  27833. +     false,            /* partial_inplace */
  27834. +     0,            /* src_mask */
  27835. +     0xffff,        /* dst_mask */
  27836. +     false),         /* pcrel_offset */
  27837. +
  27838. +  /* Upper 16 bits of a relocation relative to _SDA_BASE */
  27839. +  HOWTO (R_PPC_MORPHOS_DREL_HA,    /* type */
  27840. +     16,            /* rightshift */
  27841. +     1,            /* size (0 = byte, 1 = short, 2 = long) */
  27842. +     16,            /* bitsize */
  27843. +     false,            /* pc_relative */
  27844. +     0,            /* bitpos */
  27845. +     complain_overflow_dont,/* complain_on_overflow */
  27846. +     /*complain_overflow_bitfield,*/ /* complain_on_overflow */
  27847. +     bfd_elf_generic_reloc,    /* special_function */
  27848. +     "R_PPC_MORPHOS_DREL_HA",/* name */
  27849. +     false,            /* partial_inplace */
  27850. +     0,            /* src_mask */
  27851. +     0xffff,        /* dst_mask */
  27852. +     false),        /* pcrel_offset */
  27853. +};
  27854. +
  27855. +/* Initialize the ppc_elf_howto_table, so that linear accesses can be done.  */
  27856. +
  27857. +static void
  27858. +ppc_elf_howto_init ()
  27859. +{
  27860. +  unsigned int i, type;
  27861. +
  27862. +  for (i = 0; i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); i++)
  27863. +    {
  27864. +      type = ppc_elf_howto_raw[i].type;
  27865. +      BFD_ASSERT (type < sizeof (ppc_elf_howto_table) / sizeof (ppc_elf_howto_table[0]));
  27866. +      ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i];
  27867. +    }
  27868. +}
  27869. +
  27870. +/* This function handles relaxing for the PPC with option --mpc860c0[=<n>].
  27871. +
  27872. +   The MPC860, revision C0 or earlier contains a bug in the die.
  27873. +   If all of the following conditions are true, the next instruction
  27874. +   to be executed *may* be treated as a no-op.
  27875. +   1/ A forward branch is executed.
  27876. +   2/ The branch is predicted as not taken.
  27877. +   3/ The branch is taken.
  27878. +   4/ The branch is located in the last 5 words of a page.
  27879. +      (The EOP limit is 5 by default but may be specified as any value from 1-10.)
  27880. +
  27881. +   Our software solution is to detect these problematic branches in a
  27882. +   linker pass and modify them as follows:
  27883. +   1/ Unconditional branches - Since these are always predicted taken,
  27884. +      there is no problem and no action is required.
  27885. +   2/ Conditional backward branches - No problem, no action required.
  27886. +   3/ Conditional forward branches - Ensure that the "inverse prediction
  27887. +      bit" is set (ensure it is predicted taken).
  27888. +   4/ Conditional register branches - Ensure that the "y bit" is set
  27889. +      (ensure it is predicted taken).
  27890. +*/
  27891. +
  27892. +/* Sort sections by address.  */
  27893. +
  27894. +static int
  27895. +ppc_elf_sort_rela (arg1, arg2)
  27896. +     const PTR arg1;
  27897. +     const PTR arg2;
  27898. +{
  27899. +  const Elf_Internal_Rela **rela1 = (const Elf_Internal_Rela**) arg1;
  27900. +  const Elf_Internal_Rela **rela2 = (const Elf_Internal_Rela**) arg2;
  27901. +
  27902. +  /* Sort by offset.  */
  27903. +  return ((*rela1)->r_offset - (*rela2)->r_offset);
  27904. +}
  27905. +
  27906. +static boolean
  27907. +ppc_elf_relax_section (abfd, isec, link_info, again)
  27908. +     bfd *abfd;
  27909. +     asection *isec;
  27910. +     struct bfd_link_info *link_info;
  27911. +     boolean *again;
  27912. +{
  27913. +#define PAGESIZE 0x1000
  27914. +
  27915. +  bfd_byte *contents = NULL;
  27916. +  bfd_byte *free_contents = NULL;
  27917. +  Elf_Internal_Rela *internal_relocs = NULL;
  27918. +  Elf_Internal_Rela *free_relocs = NULL;
  27919. +  Elf_Internal_Rela **rela_comb = NULL;
  27920. +  int comb_curr, comb_count;
  27921. +
  27922. +  /* We never have to do this more than once per input section.  */
  27923. +  *again = false;
  27924. +
  27925. +  /* If needed, initialize this section's cooked size.  */
  27926. +  if (isec->_cooked_size == 0)
  27927. +      isec->_cooked_size = isec->_raw_size;
  27928. +
  27929. +  /* We're only interested in text sections which overlap the
  27930. +     troublesome area at the end of a page.  */
  27931. +  if (link_info->mpc860c0 && (isec->flags & SEC_CODE) && isec->_cooked_size)
  27932. +    {
  27933. +      bfd_vma dot, end_page, end_section;
  27934. +      boolean section_modified;
  27935. +
  27936. +      /* Get the section contents.  */
  27937. +      /* Get cached copy if it exists.  */
  27938. +      if (elf_section_data (isec)->this_hdr.contents != NULL)
  27939. +      contents = elf_section_data (isec)->this_hdr.contents;
  27940. +      else
  27941. +    {
  27942. +      /* Go get them off disk.  */
  27943. +      contents = (bfd_byte *) bfd_malloc (isec->_raw_size);
  27944. +      if (contents == NULL)
  27945. +        goto error_return;
  27946. +      free_contents = contents;
  27947. +
  27948. +      if (! bfd_get_section_contents (abfd, isec, contents,
  27949. +                      (file_ptr) 0, isec->_raw_size))
  27950. +        goto error_return;
  27951. +    }
  27952. +
  27953. +      comb_curr = 0;
  27954. +      comb_count = 0;
  27955. +      if (isec->reloc_count)
  27956. +    {
  27957. +          unsigned n;
  27958. +      bfd_size_type amt;
  27959. +
  27960. +          /* Get a copy of the native relocations.  */
  27961. +          internal_relocs = _bfd_elf32_link_read_relocs (
  27962. +            abfd, isec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
  27963. +            link_info->keep_memory);
  27964. +          if (internal_relocs == NULL)
  27965. +              goto error_return;
  27966. +          if (! link_info->keep_memory)
  27967. +              free_relocs = internal_relocs;
  27968. +
  27969. +          /* Setup a faster access method for the reloc info we need.  */
  27970. +      amt = isec->reloc_count;
  27971. +      amt *= sizeof (Elf_Internal_Rela*);
  27972. +          rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt);
  27973. +          if (rela_comb == NULL)
  27974. +              goto error_return;
  27975. +          for (n = 0; n < isec->reloc_count; ++n)
  27976. +            {
  27977. +              long r_type;
  27978. +
  27979. +              r_type = ELF32_R_TYPE (internal_relocs[n].r_info);
  27980. +              if (r_type < 0 || r_type >= (int) R_PPC_max)
  27981. +                  goto error_return;
  27982. +
  27983. +              /* Prologue constants are sometimes present in the ".text"
  27984. +              sections and they can be identified by their associated relocation.
  27985. +              We don't want to process those words and some others which
  27986. +              can also be identified by their relocations.  However, not all
  27987. +              conditional branches will have a relocation so we will
  27988. +              only ignore words that 1) have a reloc, and 2) the reloc
  27989. +              is not applicable to a conditional branch.
  27990. +              The array rela_comb is built here for use in the EOP scan loop.  */
  27991. +              switch (r_type)
  27992. +                {
  27993. +                case R_PPC_ADDR14_BRNTAKEN:     /* absolute, predicted not taken */
  27994. +                case R_PPC_REL14:               /* relative cond. br.  */
  27995. +                case R_PPC_REL14_BRNTAKEN:      /* rel. cond. br., predicted not taken */
  27996. +                  /* We should check the instruction.  */
  27997. +                  break;
  27998. +                default:
  27999. +                  /* The word is not a conditional branch - ignore it.  */
  28000. +                  rela_comb[comb_count++] = &internal_relocs[n];
  28001. +                  break;
  28002. +                }
  28003. +            }
  28004. +          if (comb_count > 1)
  28005. +        qsort (rela_comb, (size_t) comb_count, sizeof (int), ppc_elf_sort_rela);
  28006. +    }
  28007. +
  28008. +      /* Enumerate each EOP region that overlaps this section.  */
  28009. +      end_section = isec->vma + isec->_cooked_size;
  28010. +      dot = end_page = (isec->vma | (PAGESIZE - 1)) + 1;
  28011. +      dot -= link_info->mpc860c0;
  28012. +      section_modified = false;
  28013. +      if (dot < isec->vma)      /* Increment the start position if this section */
  28014. +          dot = isec->vma;      /* begins in the middle of its first EOP region.  */
  28015. +      for (;
  28016. +           dot < end_section;
  28017. +           dot += PAGESIZE, end_page += PAGESIZE)
  28018. +        {
  28019. +
  28020. +          /* Check each word in this EOP region.  */
  28021. +          for (; dot < end_page; dot += 4)
  28022. +            {
  28023. +              bfd_vma isec_offset;
  28024. +              unsigned long insn;
  28025. +              boolean skip, modified;
  28026. +
  28027. +              /* Don't process this word if there is a relocation for it and
  28028. +              the relocation indicates the word is not a conditional branch.  */
  28029. +              skip = false;
  28030. +              isec_offset = dot - isec->vma;
  28031. +              for (; comb_curr<comb_count; ++comb_curr)
  28032. +                {
  28033. +                  bfd_vma r_offset;
  28034. +
  28035. +                  r_offset = rela_comb[comb_curr]->r_offset;
  28036. +                  if (r_offset >= isec_offset)
  28037. +                    {
  28038. +                      if (r_offset == isec_offset) skip = true;
  28039. +                      break;
  28040. +                    }
  28041. +                }
  28042. +              if (skip) continue;
  28043. +
  28044. +              /* Check the current word for a problematic conditional branch.  */
  28045. +#define BO0(insn) ((insn) & 0x02000000)
  28046. +#define BO2(insn) ((insn) & 0x00800000)
  28047. +#define BO4(insn) ((insn) & 0x00200000)
  28048. +              insn = (unsigned long) bfd_get_32 (abfd, contents + isec_offset);
  28049. +              modified = false;
  28050. +              if ((insn & 0xFc000000) == 0x40000000)
  28051. +                {
  28052. +                  /* Instruction is BCx */
  28053. +                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
  28054. +                    {
  28055. +                      bfd_vma target;
  28056. +                      /* This branch is predicted as "normal".
  28057. +                      If this is a forward branch, it is problematic.  */
  28058. +
  28059. +                      target = insn & 0x0000Fffc;               /*extract*/
  28060. +                      target = (target ^ 0x8000) - 0x8000;      /*sign extend*/
  28061. +                      if ((insn & 0x00000002) == 0)
  28062. +                          target += dot;                        /*convert to abs*/
  28063. +                      if (target > dot)
  28064. +                        {
  28065. +                          insn |= 0x00200000;   /* set the prediction bit */
  28066. +                          modified = true;
  28067. +                        }
  28068. +                    }
  28069. +                }
  28070. +              else if ((insn & 0xFc00Fffe) == 0x4c000420)
  28071. +                {
  28072. +                  /* Instruction is BCCTRx */
  28073. +                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
  28074. +            {
  28075. +              /* This branch is predicted as not-taken.
  28076. +              If this is a forward branch, it is problematic.
  28077. +                      Since we can't tell statically if it will branch forward,
  28078. +                      always set the prediction bit.  */
  28079. +                      insn |= 0x00200000;   /* set the prediction bit */
  28080. +                      modified = true;
  28081. +            }
  28082. +                }
  28083. +              else if ((insn & 0xFc00Fffe) == 0x4c000020)
  28084. +                {
  28085. +                  /* Instruction is BCLRx */
  28086. +                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
  28087. +            {
  28088. +              /* This branch is predicted as not-taken.
  28089. +              If this is a forward branch, it is problematic.
  28090. +                      Since we can't tell statically if it will branch forward,
  28091. +                      always set the prediction bit.  */
  28092. +                      insn |= 0x00200000;   /* set the prediction bit */
  28093. +                      modified = true;
  28094. +            }
  28095. +                }
  28096. +#undef BO0
  28097. +#undef BO2
  28098. +#undef BO4
  28099. +              if (modified)
  28100. +            {
  28101. +                  bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset);
  28102. +          section_modified = true;
  28103. +            }
  28104. +            }
  28105. +        }
  28106. +      if (section_modified)
  28107. +    {
  28108. +      elf_section_data (isec)->this_hdr.contents = contents;
  28109. +      free_contents = NULL;
  28110. +    }
  28111. +    }
  28112. +
  28113. +  if (rela_comb != NULL)
  28114. +    {
  28115. +      free (rela_comb);
  28116. +      rela_comb = NULL;
  28117. +    }
  28118. +
  28119. +  if (free_relocs != NULL)
  28120. +    {
  28121. +      free (free_relocs);
  28122. +      free_relocs = NULL;
  28123. +    }
  28124. +
  28125. +  if (free_contents != NULL)
  28126. +    {
  28127. +      if (! link_info->keep_memory)
  28128. +    free (free_contents);
  28129. +      else
  28130. +    {
  28131. +      /* Cache the section contents for elf_link_input_bfd.  */
  28132. +      elf_section_data (isec)->this_hdr.contents = contents;
  28133. +    }
  28134. +      free_contents = NULL;
  28135. +    }
  28136. +
  28137. +  return true;
  28138. +
  28139. +error_return:
  28140. +  if (rela_comb != NULL)
  28141. +    free (rela_comb);
  28142. +  if (free_relocs != NULL)
  28143. +    free (free_relocs);
  28144. +  if (free_contents != NULL)
  28145. +    free (free_contents);
  28146. +  return false;
  28147. +}
  28148. +
  28149. +static reloc_howto_type *
  28150. +ppc_elf_reloc_type_lookup (abfd, code)
  28151. +     bfd *abfd ATTRIBUTE_UNUSED;
  28152. +     bfd_reloc_code_real_type code;
  28153. +{
  28154. +  enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
  28155. +
  28156. +  if (!ppc_elf_howto_table[R_PPC_ADDR32])
  28157. +    /* Initialize howto table if needed.  */
  28158. +    ppc_elf_howto_init ();
  28159. +
  28160. +  switch ((int) code)
  28161. +    {
  28162. +    default:
  28163. +      return (reloc_howto_type *) NULL;
  28164. +
  28165. +    case BFD_RELOC_NONE:        ppc_reloc = R_PPC_NONE;            break;
  28166. +    case BFD_RELOC_32:            ppc_reloc = R_PPC_ADDR32;        break;
  28167. +    case BFD_RELOC_PPC_BA26:        ppc_reloc = R_PPC_ADDR24;        break;
  28168. +    case BFD_RELOC_16:            ppc_reloc = R_PPC_ADDR16;        break;
  28169. +    case BFD_RELOC_LO16:        ppc_reloc = R_PPC_ADDR16_LO;        break;
  28170. +    case BFD_RELOC_HI16:        ppc_reloc = R_PPC_ADDR16_HI;        break;
  28171. +    case BFD_RELOC_HI16_S:        ppc_reloc = R_PPC_ADDR16_HA;        break;
  28172. +    case BFD_RELOC_PPC_BA16:        ppc_reloc = R_PPC_ADDR14;        break;
  28173. +    case BFD_RELOC_PPC_BA16_BRTAKEN:    ppc_reloc = R_PPC_ADDR14_BRTAKEN;    break;
  28174. +    case BFD_RELOC_PPC_BA16_BRNTAKEN:    ppc_reloc = R_PPC_ADDR14_BRNTAKEN;    break;
  28175. +    case BFD_RELOC_PPC_B26:        ppc_reloc = R_PPC_REL24;        break;
  28176. +    case BFD_RELOC_PPC_B16:        ppc_reloc = R_PPC_REL14;        break;
  28177. +    case BFD_RELOC_PPC_B16_BRTAKEN:    ppc_reloc = R_PPC_REL14_BRTAKEN;    break;
  28178. +    case BFD_RELOC_PPC_B16_BRNTAKEN:    ppc_reloc = R_PPC_REL14_BRNTAKEN;    break;
  28179. +    case BFD_RELOC_16_GOTOFF:        ppc_reloc = R_PPC_GOT16;        break;
  28180. +    case BFD_RELOC_LO16_GOTOFF:        ppc_reloc = R_PPC_GOT16_LO;        break;
  28181. +    case BFD_RELOC_HI16_GOTOFF:        ppc_reloc = R_PPC_GOT16_HI;        break;
  28182. +    case BFD_RELOC_HI16_S_GOTOFF:    ppc_reloc = R_PPC_GOT16_HA;        break;
  28183. +    case BFD_RELOC_24_PLT_PCREL:    ppc_reloc = R_PPC_PLTREL24;        break;
  28184. +    case BFD_RELOC_PPC_COPY:        ppc_reloc = R_PPC_COPY;            break;
  28185. +    case BFD_RELOC_PPC_GLOB_DAT:    ppc_reloc = R_PPC_GLOB_DAT;        break;
  28186. +    case BFD_RELOC_PPC_LOCAL24PC:    ppc_reloc = R_PPC_LOCAL24PC;        break;
  28187. +    case BFD_RELOC_32_PCREL:        ppc_reloc = R_PPC_REL32;        break;
  28188. +    case BFD_RELOC_32_PLTOFF:        ppc_reloc = R_PPC_PLT32;        break;
  28189. +    case BFD_RELOC_32_PLT_PCREL:    ppc_reloc = R_PPC_PLTREL32;        break;
  28190. +    case BFD_RELOC_LO16_PLTOFF:        ppc_reloc = R_PPC_PLT16_LO;        break;
  28191. +    case BFD_RELOC_HI16_PLTOFF:        ppc_reloc = R_PPC_PLT16_HI;        break;
  28192. +    case BFD_RELOC_HI16_S_PLTOFF:    ppc_reloc = R_PPC_PLT16_HA;        break;
  28193. +    case BFD_RELOC_GPREL16:        ppc_reloc = R_PPC_SDAREL16;        break;
  28194. +    case BFD_RELOC_16_BASEREL:        ppc_reloc = R_PPC_SECTOFF;        break;
  28195. +    case BFD_RELOC_LO16_BASEREL:    ppc_reloc = R_PPC_SECTOFF_LO;        break;
  28196. +    case BFD_RELOC_HI16_BASEREL:    ppc_reloc = R_PPC_SECTOFF_HI;        break;
  28197. +    case BFD_RELOC_HI16_S_BASEREL:    ppc_reloc = R_PPC_SECTOFF_HA;        break;
  28198. +    case BFD_RELOC_CTOR:        ppc_reloc = R_PPC_ADDR32;        break;
  28199. +    case BFD_RELOC_PPC_TOC16:        ppc_reloc = R_PPC_TOC16;        break;
  28200. +    case BFD_RELOC_PPC_EMB_NADDR32:    ppc_reloc = R_PPC_EMB_NADDR32;        break;
  28201. +    case BFD_RELOC_PPC_EMB_NADDR16:    ppc_reloc = R_PPC_EMB_NADDR16;        break;
  28202. +    case BFD_RELOC_PPC_EMB_NADDR16_LO:    ppc_reloc = R_PPC_EMB_NADDR16_LO;    break;
  28203. +    case BFD_RELOC_PPC_EMB_NADDR16_HI:    ppc_reloc = R_PPC_EMB_NADDR16_HI;    break;
  28204. +    case BFD_RELOC_PPC_EMB_NADDR16_HA:    ppc_reloc = R_PPC_EMB_NADDR16_HA;    break;
  28205. +    case BFD_RELOC_PPC_EMB_SDAI16:    ppc_reloc = R_PPC_EMB_SDAI16;        break;
  28206. +    case BFD_RELOC_PPC_EMB_SDA2I16:    ppc_reloc = R_PPC_EMB_SDA2I16;        break;
  28207. +    case BFD_RELOC_PPC_EMB_SDA2REL:    ppc_reloc = R_PPC_EMB_SDA2REL;        break;
  28208. +    case BFD_RELOC_PPC_EMB_SDA21:    ppc_reloc = R_PPC_EMB_SDA21;        break;
  28209. +    case BFD_RELOC_PPC_EMB_MRKREF:    ppc_reloc = R_PPC_EMB_MRKREF;        break;
  28210. +    case BFD_RELOC_PPC_EMB_RELSEC16:    ppc_reloc = R_PPC_EMB_RELSEC16;        break;
  28211. +    case BFD_RELOC_PPC_EMB_RELST_LO:    ppc_reloc = R_PPC_EMB_RELST_LO;        break;
  28212. +    case BFD_RELOC_PPC_EMB_RELST_HI:    ppc_reloc = R_PPC_EMB_RELST_HI;        break;
  28213. +    case BFD_RELOC_PPC_EMB_RELST_HA:    ppc_reloc = R_PPC_EMB_RELST_HA;        break;
  28214. +    case BFD_RELOC_PPC_EMB_BIT_FLD:    ppc_reloc = R_PPC_EMB_BIT_FLD;        break;
  28215. +    case BFD_RELOC_PPC_EMB_RELSDA:    ppc_reloc = R_PPC_EMB_RELSDA;        break;
  28216. +    case BFD_RELOC_PPC_MORPHOS_DREL:    ppc_reloc = R_PPC_MORPHOS_DREL;        break;
  28217. +    case BFD_RELOC_PPC_MORPHOS_DREL_LO:    ppc_reloc = R_PPC_MORPHOS_DREL_LO;    break;
  28218. +    case BFD_RELOC_PPC_MORPHOS_DREL_HI:    ppc_reloc = R_PPC_MORPHOS_DREL_HI;    break;
  28219. +    case BFD_RELOC_PPC_MORPHOS_DREL_HA:    ppc_reloc = R_PPC_MORPHOS_DREL_HA;    break;
  28220. +    case BFD_RELOC_VTABLE_INHERIT:    ppc_reloc = R_PPC_GNU_VTINHERIT;    break;
  28221. +    case BFD_RELOC_VTABLE_ENTRY:    ppc_reloc = R_PPC_GNU_VTENTRY;        break;
  28222. +    }
  28223. +
  28224. +  return ppc_elf_howto_table[(int) ppc_reloc];
  28225. +};
  28226. +
  28227. +/* Set the howto pointer for a PowerPC ELF reloc.  */
  28228. +
  28229. +static void
  28230. +ppc_elf_info_to_howto (abfd, cache_ptr, dst)
  28231. +     bfd *abfd ATTRIBUTE_UNUSED;
  28232. +     arelent *cache_ptr;
  28233. +     Elf32_Internal_Rela *dst;
  28234. +{
  28235. +  if (!ppc_elf_howto_table[R_PPC_ADDR32])
  28236. +    /* Initialize howto table if needed.  */
  28237. +    ppc_elf_howto_init ();
  28238. +
  28239. +  BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max);
  28240. +  cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)];
  28241. +}
  28242. +
  28243. +/* Handle the R_PPC_ADDR16_HA reloc.  */
  28244. +
  28245. +static bfd_reloc_status_type
  28246. +ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
  28247. +             output_bfd, error_message)
  28248. +     bfd *abfd ATTRIBUTE_UNUSED;
  28249. +     arelent *reloc_entry;
  28250. +     asymbol *symbol;
  28251. +     PTR data ATTRIBUTE_UNUSED;
  28252. +     asection *input_section;
  28253. +     bfd *output_bfd;
  28254. +     char **error_message ATTRIBUTE_UNUSED;
  28255. +{
  28256. +  /*bfd_vma relocation;*/
  28257. +
  28258. +  if (output_bfd != NULL)
  28259. +    {
  28260. +      reloc_entry->address += input_section->output_offset;
  28261. +      return bfd_reloc_ok;
  28262. +    }
  28263. +  else
  28264. +    {
  28265. +      reloc_entry->address += input_section->output_offset;
  28266. +      input_section->output_section->orelocation[input_section->output_section->reloc_count++]=reloc_entry;
  28267. +      return bfd_reloc_ok;
  28268. +    }
  28269. +
  28270. +  /*if (reloc_entry->address > input_section->_cooked_size)
  28271. +    return bfd_reloc_outofrange;
  28272. +
  28273. +  if (bfd_is_com_section (symbol->section))
  28274. +    relocation = 0;
  28275. +  else
  28276. +    relocation = symbol->value;
  28277. +
  28278. +  relocation += symbol->section->output_section->vma;
  28279. +  relocation += symbol->section->output_offset;
  28280. +  relocation += reloc_entry->addend;
  28281. +
  28282. +  reloc_entry->addend += (relocation & 0x8000) << 1;
  28283. +
  28284. +  return bfd_reloc_continue;*/
  28285. +}
  28286. +
  28287. +/* Fix bad default arch selected for a 32 bit input bfd when the
  28288. +   default is 64 bit.  */
  28289. +
  28290. +static boolean
  28291. +ppc_elf_object_p (abfd)
  28292. +     bfd *abfd;
  28293. +{
  28294. +  if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 64)
  28295. +    {
  28296. +      Elf_Internal_Ehdr *i_ehdr = elf_elfheader (abfd);
  28297. +
  28298. +      if (i_ehdr->e_ident[EI_CLASS] == ELFCLASS32)
  28299. +    {
  28300. +      /* Relies on arch after 64 bit default being 32 bit default.  */
  28301. +      abfd->arch_info = abfd->arch_info->next;
  28302. +      BFD_ASSERT (abfd->arch_info->bits_per_word == 32);
  28303. +    }
  28304. +    }
  28305. +  return true;
  28306. +}
  28307. +
  28308. +/* Function to set whether a module needs the -mrelocatable bit set.  */
  28309. +
  28310. +static boolean
  28311. +ppc_elf_set_private_flags (abfd, flags)
  28312. +     bfd *abfd;
  28313. +     flagword flags;
  28314. +{
  28315. +  BFD_ASSERT (!elf_flags_init (abfd)
  28316. +          || elf_elfheader (abfd)->e_flags == flags);
  28317. +
  28318. +  elf_elfheader (abfd)->e_flags = flags;
  28319. +  elf_flags_init (abfd) = true;
  28320. +  return true;
  28321. +}
  28322. +
  28323. +/* Merge backend specific data from an object file to the output
  28324. +   object file when linking */
  28325. +static boolean
  28326. +ppc_elf_merge_private_bfd_data (ibfd, obfd)
  28327. +     bfd *ibfd;
  28328. +     bfd *obfd;
  28329. +{
  28330. +  flagword old_flags;
  28331. +  flagword new_flags;
  28332. +  boolean error;
  28333. +
  28334. +  /* Check if we have the same endianess */
  28335. +  if (! _bfd_generic_verify_endian_match (ibfd, obfd))
  28336. +    return false;
  28337. +
  28338. +  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
  28339. +      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
  28340. +    return true;
  28341. +
  28342. +  new_flags = elf_elfheader (ibfd)->e_flags;
  28343. +  old_flags = elf_elfheader (obfd)->e_flags;
  28344. +  if (!elf_flags_init (obfd))    /* First call, no flags set */
  28345. +    {
  28346. +      elf_flags_init (obfd) = true;
  28347. +      elf_elfheader (obfd)->e_flags = new_flags;
  28348. +    }
  28349. +
  28350. +  else if (new_flags == old_flags)    /* Compatible flags are ok */
  28351. +    ;
  28352. +
  28353. +  else                    /* Incompatible flags */
  28354. +    {
  28355. +      /* Warn about -mrelocatable mismatch.  Allow -mrelocatable-lib to be linked
  28356. +         with either.  */
  28357. +      error = false;
  28358. +      if ((new_flags & EF_PPC_RELOCATABLE) != 0
  28359. +      && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0)
  28360. +    {
  28361. +      error = true;
  28362. +      (*_bfd_error_handler)
  28363. +        (_("%s: compiled with -mrelocatable and linked with modules compiled normally"),
  28364. +         bfd_archive_filename (ibfd));
  28365. +    }
  28366. +      else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
  28367. +           && (old_flags & EF_PPC_RELOCATABLE) != 0)
  28368. +    {
  28369. +      error = true;
  28370. +      (*_bfd_error_handler)
  28371. +        (_("%s: compiled normally and linked with modules compiled with -mrelocatable"),
  28372. +         bfd_archive_filename (ibfd));
  28373. +    }
  28374. +
  28375. +      /* The output is -mrelocatable-lib iff both the input files are.  */
  28376. +      if (! (new_flags & EF_PPC_RELOCATABLE_LIB))
  28377. +    elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB;
  28378. +
  28379. +      /* The output is -mrelocatable iff it can't be -mrelocatable-lib,
  28380. +         but each input file is either -mrelocatable or -mrelocatable-lib.  */
  28381. +      if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB)
  28382. +      && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))
  28383. +      && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)))
  28384. +    elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE;
  28385. +
  28386. +      /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if any module uses it */
  28387. +      elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB);
  28388. +
  28389. +      new_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
  28390. +      old_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
  28391. +
  28392. +      /* Warn about any other mismatches */
  28393. +      if (new_flags != old_flags)
  28394. +    {
  28395. +      error = true;
  28396. +      (*_bfd_error_handler)
  28397. +        (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
  28398. +         bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
  28399. +    }
  28400. +
  28401. +      if (error)
  28402. +    {
  28403. +      bfd_set_error (bfd_error_bad_value);
  28404. +      return false;
  28405. +    }
  28406. +    }
  28407. +
  28408. +  return true;
  28409. +}
  28410. +
  28411. +/* Handle a PowerPC specific section when reading an object file.  This
  28412. +   is called when elfcode.h finds a section with an unknown type.  */
  28413. +
  28414. +static boolean
  28415. +ppc_elf_section_from_shdr (abfd, hdr, name)
  28416. +     bfd *abfd;
  28417. +     Elf32_Internal_Shdr *hdr;
  28418. +     const char *name;
  28419. +{
  28420. +  asection *newsect;
  28421. +  flagword flags;
  28422. +
  28423. +  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
  28424. +    return false;
  28425. +
  28426. +  newsect = hdr->bfd_section;
  28427. +  flags = bfd_get_section_flags (abfd, newsect);
  28428. +  if (hdr->sh_flags & SHF_EXCLUDE)
  28429. +    flags |= SEC_EXCLUDE;
  28430. +
  28431. +  if (hdr->sh_type == SHT_ORDERED)
  28432. +    flags |= SEC_SORT_ENTRIES;
  28433. +
  28434. +  bfd_set_section_flags (abfd, newsect, flags);
  28435. +  return true;
  28436. +}
  28437. +
  28438. +/* Set up any other section flags and such that may be necessary.  */
  28439. +
  28440. +static boolean
  28441. +ppc_elf_fake_sections (abfd, shdr, asect)
  28442. +     bfd *abfd ATTRIBUTE_UNUSED;
  28443. +     Elf32_Internal_Shdr *shdr;
  28444. +     asection *asect;
  28445. +{
  28446. +  if ((asect->flags & SEC_EXCLUDE) != 0)
  28447. +    shdr->sh_flags |= SHF_EXCLUDE;
  28448. +
  28449. +  if ((asect->flags & SEC_SORT_ENTRIES) != 0)
  28450. +    shdr->sh_type = SHT_ORDERED;
  28451. +
  28452. +  return true;
  28453. +}
  28454. +
  28455. +/* Create a special linker section */
  28456. +static elf_linker_section_t *
  28457. +ppc_elf_create_linker_section (abfd, info, which)
  28458. +     bfd *abfd;
  28459. +     struct bfd_link_info *info;
  28460. +     enum elf_linker_section_enum which;
  28461. +{
  28462. +  bfd *dynobj = elf_hash_table (info)->dynobj;
  28463. +  elf_linker_section_t *lsect;
  28464. +
  28465. +  /* Record the first bfd section that needs the special section */
  28466. +  if (!dynobj)
  28467. +    dynobj = elf_hash_table (info)->dynobj = abfd;
  28468. +
  28469. +  /* If this is the first time, create the section */
  28470. +  lsect = elf_linker_section (dynobj, which);
  28471. +  if (!lsect)
  28472. +    {
  28473. +      elf_linker_section_t defaults;
  28474. +      static elf_linker_section_t zero_section;
  28475. +
  28476. +      defaults = zero_section;
  28477. +      defaults.which = which;
  28478. +      defaults.hole_written_p = false;
  28479. +      defaults.alignment = 2;
  28480. +
  28481. +      /* Both of these sections are (technically) created by the user
  28482. +     putting data in them, so they shouldn't be marked
  28483. +     SEC_LINKER_CREATED.
  28484. +
  28485. +     The linker creates them so it has somewhere to attach their
  28486. +     respective symbols. In fact, if they were empty it would
  28487. +     be OK to leave the symbol set to 0 (or any random number), because
  28488. +     the appropriate register should never be used.  */
  28489. +      defaults.flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
  28490. +            | SEC_IN_MEMORY);
  28491. +
  28492. +      switch (which)
  28493. +    {
  28494. +    default:
  28495. +      (*_bfd_error_handler) (_("%s: Unknown special linker type %d"),
  28496. +                 bfd_get_filename (abfd),
  28497. +                 (int) which);
  28498. +
  28499. +      bfd_set_error (bfd_error_bad_value);
  28500. +      return (elf_linker_section_t *) 0;
  28501. +
  28502. +    case LINKER_SECTION_SDATA:    /* .sdata/.sbss section */
  28503. +      defaults.name          = ".sdata";
  28504. +      defaults.rel_name      = ".rela.sdata";
  28505. +      defaults.bss_name      = ".sbss";
  28506. +      defaults.sym_name      = "_SDA_BASE_";
  28507. +      defaults.sym_offset      = 32768;
  28508. +      break;
  28509. +
  28510. +    case LINKER_SECTION_SDATA2:    /* .sdata2/.sbss2 section */
  28511. +      defaults.name          = ".sdata2";
  28512. +      defaults.rel_name      = ".rela.sdata2";
  28513. +      defaults.bss_name      = ".sbss2";
  28514. +      defaults.sym_name      = "_SDA2_BASE_";
  28515. +      defaults.sym_offset      = 32768;
  28516. +      defaults.flags     |= SEC_READONLY;
  28517. +      break;
  28518. +    }
  28519. +
  28520. +      lsect = _bfd_elf_create_linker_section (abfd, info, which, &defaults);
  28521. +    }
  28522. +
  28523. +  return lsect;
  28524. +}
  28525. +
  28526. +/* If we have a non-zero sized .sbss2 or .PPC.EMB.sbss0 sections, we
  28527. +   need to bump up the number of section headers.  */
  28528. +
  28529. +static int
  28530. +ppc_elf_additional_program_headers (abfd)
  28531. +     bfd *abfd;
  28532. +{
  28533. +  asection *s;
  28534. +  int ret;
  28535. +
  28536. +  ret = 0;
  28537. +
  28538. +  s = bfd_get_section_by_name (abfd, ".interp");
  28539. +  if (s != NULL)
  28540. +    ++ret;
  28541. +
  28542. +  s = bfd_get_section_by_name (abfd, ".sbss2");
  28543. +  if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
  28544. +    ++ret;
  28545. +
  28546. +  s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0");
  28547. +  if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0)
  28548. +    ++ret;
  28549. +
  28550. +  return ret;
  28551. +}
  28552. +
  28553. +/* Modify the segment map if needed.  */
  28554. +
  28555. +static boolean
  28556. +ppc_elf_modify_segment_map (abfd)
  28557. +     bfd *abfd ATTRIBUTE_UNUSED;
  28558. +{
  28559. +  return true;
  28560. +}
  28561. +
  28562. +/* The powerpc .got has a blrl instruction in it.  Mark it executable.  */
  28563. +
  28564. +static asection *
  28565. +ppc_elf_create_got (abfd, info)
  28566. +     bfd *abfd;
  28567. +     struct bfd_link_info *info;
  28568. +{
  28569. +  register asection *s;
  28570. +  flagword flags;
  28571. +
  28572. +  if (!_bfd_elf_create_got_section (abfd, info))
  28573. +    return NULL;
  28574. +
  28575. +  s = bfd_get_section_by_name (abfd, ".got");
  28576. +  if (s == NULL)
  28577. +    abort ();
  28578. +
  28579. +  flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY
  28580. +       | SEC_LINKER_CREATED);
  28581. +  if (!bfd_set_section_flags (abfd, s, flags))
  28582. +    return NULL;
  28583. +  return s;
  28584. +}
  28585. +
  28586. +/* We have to create .dynsbss and .rela.sbss here so that they get mapped
  28587. +   to output sections (just like _bfd_elf_create_dynamic_sections has
  28588. +   to create .dynbss and .rela.bss).  */
  28589. +
  28590. +static boolean
  28591. +ppc_elf_create_dynamic_sections (abfd, info)
  28592. +     bfd *abfd;
  28593. +     struct bfd_link_info *info;
  28594. +{
  28595. +  register asection *s;
  28596. +  flagword flags;
  28597. +
  28598. +  if (!ppc_elf_create_got (abfd, info))
  28599. +    return false;
  28600. +
  28601. +  if (!_bfd_elf_create_dynamic_sections (abfd, info))
  28602. +    return false;
  28603. +
  28604. +  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
  28605. +       | SEC_LINKER_CREATED);
  28606. +
  28607. +  s = bfd_make_section (abfd, ".dynsbss");
  28608. +  if (s == NULL
  28609. +      || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
  28610. +    return false;
  28611. +
  28612. +  if (! info->shared)
  28613. +    {
  28614. +      s = bfd_make_section (abfd, ".rela.sbss");
  28615. +      if (s == NULL
  28616. +      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
  28617. +      || ! bfd_set_section_alignment (abfd, s, 2))
  28618. +    return false;
  28619. +    }
  28620. +
  28621. +  s = bfd_get_section_by_name (abfd, ".plt");
  28622. +  if (s == NULL)
  28623. +    abort ();
  28624. +
  28625. +  flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED;
  28626. +  return bfd_set_section_flags (abfd, s, flags);
  28627. +}
  28628. +
  28629. +/* Adjust a symbol defined by a dynamic object and referenced by a
  28630. +   regular object.  The current definition is in some section of the
  28631. +   dynamic object, but we're not including those sections.  We have to
  28632. +   change the definition to something the rest of the link can
  28633. +   understand.  */
  28634. +
  28635. +static boolean
  28636. +ppc_elf_adjust_dynamic_symbol (info, h)
  28637. +     struct bfd_link_info *info;
  28638. +     struct elf_link_hash_entry *h;
  28639. +{
  28640. +  bfd *dynobj = elf_hash_table (info)->dynobj;
  28641. +  asection *s;
  28642. +  unsigned int power_of_two;
  28643. +  bfd_vma plt_offset;
  28644. +
  28645. +#ifdef DEBUG
  28646. +  fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n", h->root.root.string);
  28647. +#endif
  28648. +
  28649. +  /* Make sure we know what is going on here.  */
  28650. +  BFD_ASSERT (dynobj != NULL
  28651. +          && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
  28652. +          || h->weakdef != NULL
  28653. +          || ((h->elf_link_hash_flags
  28654. +               & ELF_LINK_HASH_DEF_DYNAMIC) != 0
  28655. +              && (h->elf_link_hash_flags
  28656. +              & ELF_LINK_HASH_REF_REGULAR) != 0
  28657. +              && (h->elf_link_hash_flags
  28658. +              & ELF_LINK_HASH_DEF_REGULAR) == 0)));
  28659. +
  28660. +  /* If this is a function, put it in the procedure linkage table.  We
  28661. +     will fill in the contents of the procedure linkage table later,
  28662. +     when we know the address of the .got section.  */
  28663. +  if (h->type == STT_FUNC
  28664. +      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
  28665. +    {
  28666. +      if (! elf_hash_table (info)->dynamic_sections_created
  28667. +       || SYMBOL_CALLS_LOCAL (info, h)
  28668. +      || (info->shared && h->plt.refcount <= 0))
  28669. +    {
  28670. +      /* A PLT entry is not required/allowed when:
  28671. +
  28672. +         1. We are not using ld.so; because then the PLT entry
  28673. +         can't be set up, so we can't use one.
  28674. +
  28675. +         2. We know for certain that a call to this symbol
  28676. +         will go to this object.
  28677. +
  28678. +         3. GC has rendered the entry unused.
  28679. +         Note, however, that in an executable all references to the
  28680. +         symbol go to the PLT, so we can't turn it off in that case.
  28681. +         ??? The correct thing to do here is to reference count
  28682. +         all uses of the symbol, not just those to the GOT or PLT.  */
  28683. +      h->plt.offset = (bfd_vma) -1;
  28684. +      h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
  28685. +      return true;
  28686. +    }
  28687. +
  28688. +      /* Make sure this symbol is output as a dynamic symbol.  */
  28689. +      if (h->dynindx == -1)
  28690. +    {
  28691. +      if (! bfd_elf32_link_record_dynamic_symbol (info, h))
  28692. +        return false;
  28693. +    }
  28694. +      BFD_ASSERT (h->dynindx != -1);
  28695. +
  28696. +      s = bfd_get_section_by_name (dynobj, ".plt");
  28697. +      BFD_ASSERT (s != NULL);
  28698. +
  28699. +      /* If this is the first .plt entry, make room for the special
  28700. +     first entry.  */
  28701. +      if (s->_raw_size == 0)
  28702. +    s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
  28703. +
  28704. +      /* The PowerPC PLT is actually composed of two parts, the first part
  28705. +     is 2 words (for a load and a jump), and then there is a remaining
  28706. +     word available at the end.  */
  28707. +      plt_offset = (PLT_INITIAL_ENTRY_SIZE
  28708. +            + (PLT_SLOT_SIZE
  28709. +               * ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE)
  28710. +              / PLT_ENTRY_SIZE)));
  28711. +
  28712. +      /* If this symbol is not defined in a regular file, and we are
  28713. +     not generating a shared library, then set the symbol to this
  28714. +     location in the .plt.  This is required to make function
  28715. +     pointers compare as equal between the normal executable and
  28716. +     the shared library.  */
  28717. +      if (! info->shared
  28718. +      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
  28719. +    {
  28720. +      h->root.u.def.section = s;
  28721. +      h->root.u.def.value = plt_offset;
  28722. +    }
  28723. +
  28724. +      h->plt.offset = plt_offset;
  28725. +
  28726. +      /* Make room for this entry.  After the 8192nd entry, room
  28727. +         for two entries is allocated.  */
  28728. +      if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
  28729. +      >= PLT_NUM_SINGLE_ENTRIES)
  28730. +    s->_raw_size += 2 * PLT_ENTRY_SIZE;
  28731. +      else
  28732. +    s->_raw_size += PLT_ENTRY_SIZE;
  28733. +
  28734. +      /* We also need to make an entry in the .rela.plt section.  */
  28735. +      s = bfd_get_section_by_name (dynobj, ".rela.plt");
  28736. +      BFD_ASSERT (s != NULL);
  28737. +      s->_raw_size += sizeof (Elf32_External_Rela);
  28738. +
  28739. +      return true;
  28740. +    }
  28741. +  else
  28742. +    h->plt.offset = (bfd_vma) -1;
  28743. +
  28744. +  /* If this is a weak symbol, and there is a real definition, the
  28745. +     processor independent code will have arranged for us to see the
  28746. +     real definition first, and we can just use the same value.  */
  28747. +  if (h->weakdef != NULL)
  28748. +    {
  28749. +      BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
  28750. +          || h->weakdef->root.type == bfd_link_hash_defweak);
  28751. +      h->root.u.def.section = h->weakdef->root.u.def.section;
  28752. +      h->root.u.def.value = h->weakdef->root.u.def.value;
  28753. +      return true;
  28754. +    }
  28755. +
  28756. +  /* This is a reference to a symbol defined by a dynamic object which
  28757. +     is not a function.  */
  28758. +
  28759. +  /* If we are creating a shared library, we must presume that the
  28760. +     only references to the symbol are via the global offset table.
  28761. +     For such cases we need not do anything here; the relocations will
  28762. +     be handled correctly by relocate_section.  */
  28763. +  if (info->shared)
  28764. +    return true;
  28765. +
  28766. +  /* We must allocate the symbol in our .dynbss section, which will
  28767. +     become part of the .bss section of the executable.  There will be
  28768. +     an entry for this symbol in the .dynsym section.  The dynamic
  28769. +     object will contain position independent code, so all references
  28770. +     from the dynamic object to this symbol will go through the global
  28771. +     offset table.  The dynamic linker will use the .dynsym entry to
  28772. +     determine the address it must put in the global offset table, so
  28773. +     both the dynamic object and the regular object will refer to the
  28774. +     same memory location for the variable.
  28775. +
  28776. +     Of course, if the symbol is sufficiently small, we must instead
  28777. +     allocate it in .sbss.  FIXME: It would be better to do this if and
  28778. +     only if there were actually SDAREL relocs for that symbol.  */
  28779. +
  28780. +  if (h->size <= elf_gp_size (dynobj))
  28781. +    s = bfd_get_section_by_name (dynobj, ".dynsbss");
  28782. +  else
  28783. +    s = bfd_get_section_by_name (dynobj, ".dynbss");
  28784. +  BFD_ASSERT (s != NULL);
  28785. +
  28786. +  /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
  28787. +     copy the initial value out of the dynamic object and into the
  28788. +     runtime process image.  We need to remember the offset into the
  28789. +     .rela.bss section we are going to use.  */
  28790. +  if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
  28791. +    {
  28792. +      asection *srel;
  28793. +
  28794. +      if (h->size <= elf_gp_size (dynobj))
  28795. +    srel = bfd_get_section_by_name (dynobj, ".rela.sbss");
  28796. +      else
  28797. +    srel = bfd_get_section_by_name (dynobj, ".rela.bss");
  28798. +      BFD_ASSERT (srel != NULL);
  28799. +      srel->_raw_size += sizeof (Elf32_External_Rela);
  28800. +      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
  28801. +    }
  28802. +
  28803. +  /* We need to figure out the alignment required for this symbol.  I
  28804. +     have no idea how ELF linkers handle this.  */
  28805. +  power_of_two = bfd_log2 (h->size);
  28806. +  if (power_of_two > 4)
  28807. +    power_of_two = 4;
  28808. +
  28809. +  /* Apply the required alignment.  */
  28810. +  s->_raw_size = BFD_ALIGN (s->_raw_size,
  28811. +                (bfd_size_type) (1 << power_of_two));
  28812. +  if (power_of_two > bfd_get_section_alignment (dynobj, s))
  28813. +    {
  28814. +      if (! bfd_set_section_alignment (dynobj, s, power_of_two))
  28815. +    return false;
  28816. +    }
  28817. +
  28818. +  /* Define the symbol as being at this point in the section.  */
  28819. +  h->root.u.def.section = s;
  28820. +  h->root.u.def.value = s->_raw_size;
  28821. +
  28822. +  /* Increment the section size to make room for the symbol.  */
  28823. +  s->_raw_size += h->size;
  28824. +
  28825. +  return true;
  28826. +}
  28827. +
  28828. +/* Set the sizes of the dynamic sections.  */
  28829. +
  28830. +static boolean
  28831. +ppc_elf_size_dynamic_sections (output_bfd, info)
  28832. +     bfd *output_bfd ATTRIBUTE_UNUSED;
  28833. +     struct bfd_link_info *info;
  28834. +{
  28835. +  bfd *dynobj;
  28836. +  asection *s;
  28837. +  boolean plt;
  28838. +  boolean relocs;
  28839. +
  28840. +#ifdef DEBUG
  28841. +  fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
  28842. +#endif
  28843. +
  28844. +  dynobj = elf_hash_table (info)->dynobj;
  28845. +  BFD_ASSERT (dynobj != NULL);
  28846. +
  28847. +  if (elf_hash_table (info)->dynamic_sections_created)
  28848. +    {
  28849. +      /* Set the contents of the .interp section to the interpreter.  */
  28850. +      if (! info->shared)
  28851. +    {
  28852. +      s = bfd_get_section_by_name (dynobj, ".interp");
  28853. +      BFD_ASSERT (s != NULL);
  28854. +      s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
  28855. +      s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
  28856. +    }
  28857. +    }
  28858. +  else
  28859. +    {
  28860. +      /* We may have created entries in the .rela.got, .rela.sdata, and
  28861. +     .rela.sdata2 sections.  However, if we are not creating the
  28862. +     dynamic sections, we will not actually use these entries.  Reset
  28863. +     the size of .rela.got, et al, which will cause it to get
  28864. +     stripped from the output file below.  */
  28865. +      static char *rela_sections[] = { ".rela.got", ".rela.sdata",
  28866. +                       ".rela.sdata2", ".rela.sbss",
  28867. +                       (char *) 0 };
  28868. +      char **p;
  28869. +
  28870. +      for (p = rela_sections; *p != (char *) 0; p++)
  28871. +    {
  28872. +      s = bfd_get_section_by_name (dynobj, *p);
  28873. +      if (s != NULL)
  28874. +        s->_raw_size = 0;
  28875. +    }
  28876. +    }
  28877. +
  28878. +  /* The check_relocs and adjust_dynamic_symbol entry points have
  28879. +     determined the sizes of the various dynamic sections.  Allocate
  28880. +     memory for them.  */
  28881. +  plt = false;
  28882. +  relocs = false;
  28883. +  for (s = dynobj->sections; s != NULL; s = s->next)
  28884. +    {
  28885. +      const char *name;
  28886. +      boolean strip;
  28887. +
  28888. +      if ((s->flags & SEC_LINKER_CREATED) == 0)
  28889. +    continue;
  28890. +
  28891. +      /* It's OK to base decisions on the section name, because none
  28892. +     of the dynobj section names depend upon the input files.  */
  28893. +      name = bfd_get_section_name (dynobj, s);
  28894. +
  28895. +      strip = false;
  28896. +
  28897. +      if (strcmp (name, ".plt") == 0)
  28898. +    {
  28899. +      if (s->_raw_size == 0)
  28900. +        {
  28901. +          /* Strip this section if we don't need it; see the
  28902. +                 comment below.  */
  28903. +          strip = true;
  28904. +        }
  28905. +      else
  28906. +        {
  28907. +          /* Remember whether there is a PLT.  */
  28908. +          plt = true;
  28909. +        }
  28910. +    }
  28911. +      else if (strncmp (name, ".rela", 5) == 0)
  28912. +    {
  28913. +      if (s->_raw_size == 0)
  28914. +        {
  28915. +          /* If we don't need this section, strip it from the
  28916. +         output file.  This is mostly to handle .rela.bss and
  28917. +         .rela.plt.  We must create both sections in
  28918. +         create_dynamic_sections, because they must be created
  28919. +         before the linker maps input sections to output
  28920. +         sections.  The linker does that before
  28921. +         adjust_dynamic_symbol is called, and it is that
  28922. +         function which decides whether anything needs to go
  28923. +         into these sections.  */
  28924. +          strip = true;
  28925. +        }
  28926. +      else
  28927. +        {
  28928. +          /* Remember whether there are any relocation sections.  */
  28929. +          relocs = true;
  28930. +
  28931. +          /* We use the reloc_count field as a counter if we need
  28932. +         to copy relocs into the output file.  */
  28933. +          s->reloc_count = 0;
  28934. +        }
  28935. +    }
  28936. +      else if (strcmp (name, ".got") != 0
  28937. +           && strcmp (name, ".sdata") != 0
  28938. +           && strcmp (name, ".sdata2") != 0)
  28939. +    {
  28940. +      /* It's not one of our sections, so don't allocate space.  */
  28941. +      continue;
  28942. +    }
  28943. +
  28944. +      if (strip)
  28945. +    {
  28946. +      _bfd_strip_section_from_output (info, s);
  28947. +      continue;
  28948. +    }
  28949. +
  28950. +      /* Allocate memory for the section contents.  */
  28951. +      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
  28952. +      if (s->contents == NULL && s->_raw_size != 0)
  28953. +    return false;
  28954. +    }
  28955. +
  28956. +  if (elf_hash_table (info)->dynamic_sections_created)
  28957. +    {
  28958. +      /* Add some entries to the .dynamic section.  We fill in the
  28959. +     values later, in ppc_elf_finish_dynamic_sections, but we
  28960. +     must add the entries now so that we get the correct size for
  28961. +     the .dynamic section.  The DT_DEBUG entry is filled in by the
  28962. +     dynamic linker and used by the debugger.  */
  28963. +#define add_dynamic_entry(TAG, VAL) \
  28964. +  bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
  28965. +
  28966. +      if (!info->shared)
  28967. +    {
  28968. +      if (!add_dynamic_entry (DT_DEBUG, 0))
  28969. +        return false;
  28970. +    }
  28971. +
  28972. +      if (plt)
  28973. +    {
  28974. +      if (!add_dynamic_entry (DT_PLTGOT, 0)
  28975. +          || !add_dynamic_entry (DT_PLTRELSZ, 0)
  28976. +          || !add_dynamic_entry (DT_PLTREL, DT_RELA)
  28977. +          || !add_dynamic_entry (DT_JMPREL, 0))
  28978. +        return false;
  28979. +    }
  28980. +
  28981. +      if (relocs)
  28982. +    {
  28983. +      if (!add_dynamic_entry (DT_RELA, 0)
  28984. +          || !add_dynamic_entry (DT_RELASZ, 0)
  28985. +          || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
  28986. +        return false;
  28987. +    }
  28988. +
  28989. +      if ((info->flags & DF_TEXTREL) != 0)
  28990. +    {
  28991. +      if (!add_dynamic_entry (DT_TEXTREL, 0))
  28992. +        return false;
  28993. +      info->flags |= DF_TEXTREL;
  28994. +    }
  28995. +    }
  28996. +#undef add_dynamic_entry
  28997. +
  28998. +  return true;
  28999. +}
  29000. +
  29001. +/* Look through the relocs for a section during the first phase, and
  29002. +   allocate space in the global offset table or procedure linkage
  29003. +   table.  */
  29004. +
  29005. +static boolean
  29006. +ppc_elf_check_relocs (abfd, info, sec, relocs)
  29007. +     bfd *abfd;
  29008. +     struct bfd_link_info *info;
  29009. +     asection *sec;
  29010. +     const Elf_Internal_Rela *relocs;
  29011. +{
  29012. +  bfd *dynobj;
  29013. +  Elf_Internal_Shdr *symtab_hdr;
  29014. +  struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
  29015. +  const Elf_Internal_Rela *rel;
  29016. +  const Elf_Internal_Rela *rel_end;
  29017. +  bfd_signed_vma *local_got_refcounts;
  29018. +  elf_linker_section_t *sdata;
  29019. +  elf_linker_section_t *sdata2;
  29020. +  asection *sreloc;
  29021. +  asection *sgot = NULL;
  29022. +  asection *srelgot = NULL;
  29023. +
  29024. +  if (info->relocateable)
  29025. +    return true;
  29026. +
  29027. +#ifdef DEBUG
  29028. +  fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n",
  29029. +       bfd_get_section_name (abfd, sec),
  29030. +       bfd_archive_filename (abfd));
  29031. +#endif
  29032. +
  29033. +  /* Create the linker generated sections all the time so that the
  29034. +     special symbols are created.  */
  29035. +
  29036. +  if ((sdata = elf_linker_section (abfd, LINKER_SECTION_SDATA)) == NULL)
  29037. +    {
  29038. +      sdata = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA);
  29039. +      if (!sdata)
  29040. +    return false;
  29041. +    }
  29042. +
  29043. +  if ((sdata2 = elf_linker_section (abfd, LINKER_SECTION_SDATA2)) == NULL)
  29044. +    {
  29045. +      sdata2 = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA2);
  29046. +      if (!sdata2)
  29047. +    return false;
  29048. +    }
  29049. +
  29050. +  dynobj = elf_hash_table (info)->dynobj;
  29051. +  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  29052. +  local_got_refcounts = elf_local_got_refcounts (abfd);
  29053. +
  29054. +  sym_hashes = elf_sym_hashes (abfd);
  29055. +  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
  29056. +  if (!elf_bad_symtab (abfd))
  29057. +    sym_hashes_end -= symtab_hdr->sh_info;
  29058. +
  29059. +  sreloc = NULL;
  29060. +
  29061. +  rel_end = relocs + sec->reloc_count;
  29062. +  for (rel = relocs; rel < rel_end; rel++)
  29063. +    {
  29064. +      unsigned long r_symndx;
  29065. +      struct elf_link_hash_entry *h;
  29066. +
  29067. +      r_symndx = ELF32_R_SYM (rel->r_info);
  29068. +      if (r_symndx < symtab_hdr->sh_info)
  29069. +    h = NULL;
  29070. +      else
  29071. +    h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  29072. +
  29073. +      /* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
  29074. +     This shows up in particular in an R_PPC_ADDR32 in the eabi
  29075. +     startup code.  */
  29076. +      if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
  29077. +    {
  29078. +      if (sgot == NULL)
  29079. +        {
  29080. +          if (dynobj == NULL)
  29081. +        elf_hash_table (info)->dynobj = dynobj = abfd;
  29082. +          sgot = ppc_elf_create_got (dynobj, info);
  29083. +          if (sgot == NULL)
  29084. +        return false;
  29085. +        }
  29086. +    }
  29087. +
  29088. +      switch (ELF32_R_TYPE (rel->r_info))
  29089. +    {
  29090. +    /* GOT16 relocations */
  29091. +    case R_PPC_GOT16:
  29092. +    case R_PPC_GOT16_LO:
  29093. +    case R_PPC_GOT16_HI:
  29094. +    case R_PPC_GOT16_HA:
  29095. +      /* This symbol requires a global offset table entry.  */
  29096. +
  29097. +      if (sgot == NULL)
  29098. +        {
  29099. +          if (dynobj == NULL)
  29100. +        elf_hash_table (info)->dynobj = dynobj = abfd;
  29101. +          sgot = ppc_elf_create_got (dynobj, info);
  29102. +          if (sgot == NULL)
  29103. +        return false;
  29104. +        }
  29105. +
  29106. +      if (srelgot == NULL
  29107. +          && (h != NULL || info->shared))
  29108. +        {
  29109. +          srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  29110. +          if (srelgot == NULL)
  29111. +        {
  29112. +          srelgot = bfd_make_section (dynobj, ".rela.got");
  29113. +          if (srelgot == NULL
  29114. +              || ! bfd_set_section_flags (dynobj, srelgot,
  29115. +                          (SEC_ALLOC
  29116. +                           | SEC_LOAD
  29117. +                           | SEC_HAS_CONTENTS
  29118. +                           | SEC_IN_MEMORY
  29119. +                           | SEC_LINKER_CREATED
  29120. +                           | SEC_READONLY))
  29121. +              || ! bfd_set_section_alignment (dynobj, srelgot, 2))
  29122. +            return false;
  29123. +        }
  29124. +        }
  29125. +
  29126. +      if (h != NULL)
  29127. +        {
  29128. +          if (h->got.refcount == 0)
  29129. +        {
  29130. +          /* Make sure this symbol is output as a dynamic symbol.  */
  29131. +          if (h->dynindx == -1)
  29132. +            if (!bfd_elf32_link_record_dynamic_symbol (info, h))
  29133. +              return false;
  29134. +
  29135. +          /* Allocate space in the .got.  */
  29136. +          sgot->_raw_size += 4;
  29137. +          /* Allocate relocation space.  */
  29138. +          srelgot->_raw_size += sizeof (Elf32_External_Rela);
  29139. +        }
  29140. +          h->got.refcount++;
  29141. +        }
  29142. +      else
  29143. +        {
  29144. +          /* This is a global offset table entry for a local symbol.  */
  29145. +          if (local_got_refcounts == NULL)
  29146. +        {
  29147. +          bfd_size_type size;
  29148. +
  29149. +          size = symtab_hdr->sh_info;
  29150. +          size *= sizeof (bfd_signed_vma);
  29151. +          local_got_refcounts
  29152. +            = (bfd_signed_vma *) bfd_zalloc (abfd, size);
  29153. +          if (local_got_refcounts == NULL)
  29154. +            return false;
  29155. +          elf_local_got_refcounts (abfd) = local_got_refcounts;
  29156. +        }
  29157. +          if (local_got_refcounts[r_symndx] == 0)
  29158. +        {
  29159. +          sgot->_raw_size += 4;
  29160. +
  29161. +          /* If we are generating a shared object, we need to
  29162. +                     output a R_PPC_RELATIVE reloc so that the
  29163. +                     dynamic linker can adjust this GOT entry.  */
  29164. +          if (info->shared)
  29165. +            srelgot->_raw_size += sizeof (Elf32_External_Rela);
  29166. +        }
  29167. +          local_got_refcounts[r_symndx]++;
  29168. +        }
  29169. +      break;
  29170. +
  29171. +    /* Indirect .sdata relocation */
  29172. +    case R_PPC_EMB_SDAI16:
  29173. +      if (info->shared)
  29174. +        {
  29175. +          ((*_bfd_error_handler)
  29176. +           (_("%s: relocation %s cannot be used when making a shared object"),
  29177. +        bfd_archive_filename (abfd), "R_PPC_EMB_SDAI16"));
  29178. +          return false;
  29179. +        }
  29180. +
  29181. +      if (srelgot == NULL && (h != NULL || info->shared))
  29182. +        {
  29183. +          srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  29184. +          if (srelgot == NULL)
  29185. +        {
  29186. +          srelgot = bfd_make_section (dynobj, ".rela.got");
  29187. +          if (srelgot == NULL
  29188. +              || ! bfd_set_section_flags (dynobj, srelgot,
  29189. +                          (SEC_ALLOC
  29190. +                           | SEC_LOAD
  29191. +                           | SEC_HAS_CONTENTS
  29192. +                           | SEC_IN_MEMORY
  29193. +                           | SEC_LINKER_CREATED
  29194. +                           | SEC_READONLY))
  29195. +              || ! bfd_set_section_alignment (dynobj, srelgot, 2))
  29196. +            return false;
  29197. +        }
  29198. +        }
  29199. +
  29200. +      if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata, h, rel))
  29201. +        return false;
  29202. +
  29203. +      break;
  29204. +
  29205. +    /* Indirect .sdata2 relocation */
  29206. +    case R_PPC_EMB_SDA2I16:
  29207. +      if (info->shared)
  29208. +        {
  29209. +          ((*_bfd_error_handler)
  29210. +           (_("%s: relocation %s cannot be used when making a shared object"),
  29211. +        bfd_archive_filename (abfd), "R_PPC_EMB_SDA2I16"));
  29212. +          return false;
  29213. +        }
  29214. +
  29215. +      if (srelgot == NULL && (h != NULL || info->shared))
  29216. +        {
  29217. +          srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  29218. +          if (srelgot == NULL)
  29219. +        {
  29220. +          srelgot = bfd_make_section (dynobj, ".rela.got");
  29221. +          if (srelgot == NULL
  29222. +              || ! bfd_set_section_flags (dynobj, srelgot,
  29223. +                          (SEC_ALLOC
  29224. +                           | SEC_LOAD
  29225. +                           | SEC_HAS_CONTENTS
  29226. +                           | SEC_IN_MEMORY
  29227. +                           | SEC_LINKER_CREATED
  29228. +                           | SEC_READONLY))
  29229. +              || ! bfd_set_section_alignment (dynobj, srelgot, 2))
  29230. +            return false;
  29231. +        }
  29232. +        }
  29233. +
  29234. +      if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata2, h, rel))
  29235. +        return false;
  29236. +
  29237. +      break;
  29238. +
  29239. +    case R_PPC_SDAREL16:
  29240. +    case R_PPC_EMB_SDA2REL:
  29241. +    case R_PPC_EMB_SDA21:
  29242. +      if (info->shared)
  29243. +        {
  29244. +          ((*_bfd_error_handler)
  29245. +           (_("%s: relocation %s cannot be used when making a shared object"),
  29246. +        bfd_archive_filename (abfd),
  29247. +        ppc_elf_howto_table[(int) ELF32_R_TYPE (rel->r_info)]->name));
  29248. +          return false;
  29249. +        }
  29250. +      break;
  29251. +
  29252. +    case R_PPC_PLT32:
  29253. +    case R_PPC_PLTREL24:
  29254. +    case R_PPC_PLT16_LO:
  29255. +    case R_PPC_PLT16_HI:
  29256. +    case R_PPC_PLT16_HA:
  29257. +#ifdef DEBUG
  29258. +      fprintf (stderr, "Reloc requires a PLT entry\n");
  29259. +#endif
  29260. +      /* This symbol requires a procedure linkage table entry.  We
  29261. +             actually build the entry in adjust_dynamic_symbol,
  29262. +             because this might be a case of linking PIC code without
  29263. +             linking in any dynamic objects, in which case we don't
  29264. +             need to generate a procedure linkage table after all.  */
  29265. +
  29266. +      if (h == NULL)
  29267. +        {
  29268. +          /* It does not make sense to have a procedure linkage
  29269. +                 table entry for a local symbol.  */
  29270. +          bfd_set_error (bfd_error_bad_value);
  29271. +          return false;
  29272. +        }
  29273. +
  29274. +      /* Make sure this symbol is output as a dynamic symbol.  */
  29275. +      if (h->dynindx == -1)
  29276. +        {
  29277. +          if (! bfd_elf32_link_record_dynamic_symbol (info, h))
  29278. +        return false;
  29279. +        }
  29280. +      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
  29281. +      h->plt.refcount++;
  29282. +      break;
  29283. +
  29284. +      /* The following relocations don't need to propagate the
  29285. +         relocation if linking a shared object since they are
  29286. +         section relative.  */
  29287. +    case R_PPC_SECTOFF:
  29288. +    case R_PPC_SECTOFF_LO:
  29289. +    case R_PPC_SECTOFF_HI:
  29290. +    case R_PPC_SECTOFF_HA:
  29291. +      break;
  29292. +
  29293. +      /* This refers only to functions defined in the shared library */
  29294. +    case R_PPC_LOCAL24PC:
  29295. +      break;
  29296. +
  29297. +      /* This relocation describes the C++ object vtable hierarchy.
  29298. +         Reconstruct it for later use during GC.  */
  29299. +    case R_PPC_GNU_VTINHERIT:
  29300. +      if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
  29301. +        return false;
  29302. +      break;
  29303. +
  29304. +      /* This relocation describes which C++ vtable entries are actually
  29305. +         used.  Record for later use during GC.  */
  29306. +    case R_PPC_GNU_VTENTRY:
  29307. +      if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
  29308. +        return false;
  29309. +      break;
  29310. +
  29311. +      /* When creating a shared object, we must copy these
  29312. +         relocs into the output file.  We create a reloc
  29313. +         section in dynobj and make room for the reloc.  */
  29314. +    case R_PPC_REL24:
  29315. +    case R_PPC_REL14:
  29316. +    case R_PPC_REL14_BRTAKEN:
  29317. +    case R_PPC_REL14_BRNTAKEN:
  29318. +    case R_PPC_REL32:
  29319. +      if (h == NULL
  29320. +          || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
  29321. +          || SYMBOL_REFERENCES_LOCAL (info, h))
  29322. +        break;
  29323. +      /* fall through */
  29324. +
  29325. +    default:
  29326. +      if (info->shared)
  29327. +        {
  29328. +#ifdef DEBUG
  29329. +          fprintf (stderr, "ppc_elf_check_relocs need to create relocation for %s\n",
  29330. +               (h && h->root.root.string) ? h->root.root.string : "<unknown>");
  29331. +#endif
  29332. +          if (sreloc == NULL)
  29333. +        {
  29334. +          const char *name;
  29335. +
  29336. +          name = (bfd_elf_string_from_elf_section
  29337. +              (abfd,
  29338. +               elf_elfheader (abfd)->e_shstrndx,
  29339. +               elf_section_data (sec)->rel_hdr.sh_name));
  29340. +          if (name == NULL)
  29341. +            return false;
  29342. +
  29343. +          BFD_ASSERT (strncmp (name, ".rela", 5) == 0
  29344. +                  && strcmp (bfd_get_section_name (abfd, sec),
  29345. +                     name + 5) == 0);
  29346. +
  29347. +          sreloc = bfd_get_section_by_name (dynobj, name);
  29348. +          if (sreloc == NULL)
  29349. +            {
  29350. +              flagword flags;
  29351. +
  29352. +              sreloc = bfd_make_section (dynobj, name);
  29353. +              flags = (SEC_HAS_CONTENTS | SEC_READONLY
  29354. +                   | SEC_IN_MEMORY | SEC_LINKER_CREATED);
  29355. +              if ((sec->flags & SEC_ALLOC) != 0)
  29356. +            flags |= SEC_ALLOC | SEC_LOAD;
  29357. +              if (sreloc == NULL
  29358. +              || ! bfd_set_section_flags (dynobj, sreloc, flags)
  29359. +              || ! bfd_set_section_alignment (dynobj, sreloc, 2))
  29360. +            return false;
  29361. +            }
  29362. +          if (sec->flags & SEC_READONLY)
  29363. +            info->flags |= DF_TEXTREL;
  29364. +        }
  29365. +
  29366. +          sreloc->_raw_size += sizeof (Elf32_External_Rela);
  29367. +
  29368. +          /* FIXME: We should here do what the m68k and i386
  29369. +         backends do: if the reloc is pc-relative, record it
  29370. +         in case it turns out that the reloc is unnecessary
  29371. +         because the symbol is forced local by versioning or
  29372. +         we are linking with -Bdynamic.  Fortunately this
  29373. +         case is not frequent.  */
  29374. +        }
  29375. +
  29376. +      break;
  29377. +    }
  29378. +    }
  29379. +
  29380. +  return true;
  29381. +}
  29382. +
  29383. +/* Return the section that should be marked against GC for a given
  29384. +   relocation.  */
  29385. +
  29386. +static asection *
  29387. +ppc_elf_gc_mark_hook (sec, info, rel, h, sym)
  29388. +     asection *sec;
  29389. +     struct bfd_link_info *info ATTRIBUTE_UNUSED;
  29390. +     Elf_Internal_Rela *rel;
  29391. +     struct elf_link_hash_entry *h;
  29392. +     Elf_Internal_Sym *sym;
  29393. +{
  29394. +  if (h != NULL)
  29395. +    {
  29396. +      switch (ELF32_R_TYPE (rel->r_info))
  29397. +    {
  29398. +    case R_PPC_GNU_VTINHERIT:
  29399. +    case R_PPC_GNU_VTENTRY:
  29400. +      break;
  29401. +
  29402. +    default:
  29403. +      switch (h->root.type)
  29404. +        {
  29405. +        case bfd_link_hash_defined:
  29406. +        case bfd_link_hash_defweak:
  29407. +          return h->root.u.def.section;
  29408. +
  29409. +        case bfd_link_hash_common:
  29410. +          return h->root.u.c.p->section;
  29411. +
  29412. +        default:
  29413. +          break;
  29414. +        }
  29415. +    }
  29416. +    }
  29417. +  else
  29418. +    return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
  29419. +
  29420. +  return NULL;
  29421. +}
  29422. +
  29423. +/* Update the got entry reference counts for the section being removed.  */
  29424. +
  29425. +static boolean
  29426. +ppc_elf_gc_sweep_hook (abfd, info, sec, relocs)
  29427. +     bfd *abfd;
  29428. +     struct bfd_link_info *info ATTRIBUTE_UNUSED;
  29429. +     asection *sec;
  29430. +     const Elf_Internal_Rela *relocs;
  29431. +{
  29432. +  Elf_Internal_Shdr *symtab_hdr;
  29433. +  struct elf_link_hash_entry **sym_hashes;
  29434. +  bfd_signed_vma *local_got_refcounts;
  29435. +  const Elf_Internal_Rela *rel, *relend;
  29436. +  unsigned long r_symndx;
  29437. +  struct elf_link_hash_entry *h;
  29438. +
  29439. +  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  29440. +  sym_hashes = elf_sym_hashes (abfd);
  29441. +  local_got_refcounts = elf_local_got_refcounts (abfd);
  29442. +
  29443. +  relend = relocs + sec->reloc_count;
  29444. +  for (rel = relocs; rel < relend; rel++)
  29445. +    switch (ELF32_R_TYPE (rel->r_info))
  29446. +      {
  29447. +      case R_PPC_GOT16:
  29448. +      case R_PPC_GOT16_LO:
  29449. +      case R_PPC_GOT16_HI:
  29450. +      case R_PPC_GOT16_HA:
  29451. +    r_symndx = ELF32_R_SYM (rel->r_info);
  29452. +    if (r_symndx >= symtab_hdr->sh_info)
  29453. +      {
  29454. +        h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  29455. +        if (h->got.refcount > 0)
  29456. +          h->got.refcount--;
  29457. +      }
  29458. +    else if (local_got_refcounts != NULL)
  29459. +      {
  29460. +        if (local_got_refcounts[r_symndx] > 0)
  29461. +          local_got_refcounts[r_symndx]--;
  29462. +      }
  29463. +        break;
  29464. +
  29465. +      case R_PPC_PLT32:
  29466. +      case R_PPC_PLTREL24:
  29467. +      case R_PPC_PLT16_LO:
  29468. +      case R_PPC_PLT16_HI:
  29469. +      case R_PPC_PLT16_HA:
  29470. +    r_symndx = ELF32_R_SYM (rel->r_info);
  29471. +    if (r_symndx >= symtab_hdr->sh_info)
  29472. +      {
  29473. +        h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  29474. +        if (h->plt.refcount > 0)
  29475. +          h->plt.refcount--;
  29476. +      }
  29477. +    break;
  29478. +
  29479. +      default:
  29480. +    break;
  29481. +      }
  29482. +
  29483. +  return true;
  29484. +}
  29485. +
  29486. +/* Hook called by the linker routine which adds symbols from an object
  29487. +   file.  We use it to put .comm items in .sbss, and not .bss.  */
  29488. +
  29489. +static boolean
  29490. +ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
  29491. +     bfd *abfd;
  29492. +     struct bfd_link_info *info;
  29493. +     const Elf_Internal_Sym *sym;
  29494. +     const char **namep ATTRIBUTE_UNUSED;
  29495. +     flagword *flagsp ATTRIBUTE_UNUSED;
  29496. +     asection **secp;
  29497. +     bfd_vma *valp;
  29498. +{
  29499. +  if (sym->st_shndx == SHN_COMMON
  29500. +      && !info->relocateable
  29501. +      && sym->st_size <= elf_gp_size (abfd)
  29502. +      && info->hash->creator->flavour == bfd_target_elf_flavour)
  29503. +    {
  29504. +      /* Common symbols less than or equal to -G nn bytes are automatically
  29505. +     put into .sdata.  */
  29506. +      elf_linker_section_t *sdata
  29507. +    = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA);
  29508. +
  29509. +      if (!sdata->bss_section)
  29510. +    {
  29511. +      bfd_size_type amt;
  29512. +
  29513. +      /* We don't go through bfd_make_section, because we don't
  29514. +             want to attach this common section to DYNOBJ.  The linker
  29515. +             will move the symbols to the appropriate output section
  29516. +             when it defines common symbols.  */
  29517. +      amt = sizeof (asection);
  29518. +      sdata->bss_section = (asection *) bfd_zalloc (abfd, amt);
  29519. +      if (sdata->bss_section == NULL)
  29520. +        return false;
  29521. +      sdata->bss_section->name = sdata->bss_name;
  29522. +      sdata->bss_section->flags = SEC_IS_COMMON;
  29523. +      sdata->bss_section->output_section = sdata->bss_section;
  29524. +      amt = sizeof (asymbol);
  29525. +      sdata->bss_section->symbol = (asymbol *) bfd_zalloc (abfd, amt);
  29526. +      amt = sizeof (asymbol *);
  29527. +      sdata->bss_section->symbol_ptr_ptr =
  29528. +        (asymbol **) bfd_zalloc (abfd, amt);
  29529. +      if (sdata->bss_section->symbol == NULL
  29530. +          || sdata->bss_section->symbol_ptr_ptr == NULL)
  29531. +        return false;
  29532. +      sdata->bss_section->symbol->name = sdata->bss_name;
  29533. +      sdata->bss_section->symbol->flags = BSF_SECTION_SYM;
  29534. +      sdata->bss_section->symbol->section = sdata->bss_section;
  29535. +      *sdata->bss_section->symbol_ptr_ptr = sdata->bss_section->symbol;
  29536. +    }
  29537. +
  29538. +      *secp = sdata->bss_section;
  29539. +      *valp = sym->st_size;
  29540. +    }
  29541. +
  29542. +  return true;
  29543. +}
  29544. +
  29545. +/* Finish up dynamic symbol handling.  We set the contents of various
  29546. +   dynamic sections here.  */
  29547. +
  29548. +static boolean
  29549. +ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
  29550. +     bfd *output_bfd;
  29551. +     struct bfd_link_info *info;
  29552. +     struct elf_link_hash_entry *h;
  29553. +     Elf_Internal_Sym *sym;
  29554. +{
  29555. +  bfd *dynobj;
  29556. +
  29557. +#ifdef DEBUG
  29558. +  fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s",
  29559. +       h->root.root.string);
  29560. +#endif
  29561. +
  29562. +  dynobj = elf_hash_table (info)->dynobj;
  29563. +  BFD_ASSERT (dynobj != NULL);
  29564. +
  29565. +  if (h->plt.offset != (bfd_vma) -1)
  29566. +    {
  29567. +      asection *splt;
  29568. +      asection *srela;
  29569. +      Elf_Internal_Rela rela;
  29570. +      bfd_vma reloc_index;
  29571. +
  29572. +#ifdef DEBUG
  29573. +      fprintf (stderr, ", plt_offset = %d", h->plt.offset);
  29574. +#endif
  29575. +
  29576. +      /* This symbol has an entry in the procedure linkage table.  Set
  29577. +         it up.  */
  29578. +
  29579. +      BFD_ASSERT (h->dynindx != -1);
  29580. +
  29581. +      splt = bfd_get_section_by_name (dynobj, ".plt");
  29582. +      srela = bfd_get_section_by_name (dynobj, ".rela.plt");
  29583. +      BFD_ASSERT (splt != NULL && srela != NULL);
  29584. +
  29585. +      /* We don't need to fill in the .plt.  The ppc dynamic linker
  29586. +     will fill it in.  */
  29587. +
  29588. +      /* Fill in the entry in the .rela.plt section.  */
  29589. +      rela.r_offset = (splt->output_section->vma
  29590. +               + splt->output_offset
  29591. +               + h->plt.offset);
  29592. +      rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT);
  29593. +      rela.r_addend = 0;
  29594. +
  29595. +      reloc_index = (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_SLOT_SIZE;
  29596. +      if (reloc_index > PLT_NUM_SINGLE_ENTRIES)
  29597. +    reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2;
  29598. +      bfd_elf32_swap_reloca_out (output_bfd, &rela,
  29599. +                 ((Elf32_External_Rela *) srela->contents
  29600. +                  + reloc_index));
  29601. +
  29602. +      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
  29603. +    {
  29604. +      /* Mark the symbol as undefined, rather than as defined in
  29605. +         the .plt section.  Leave the value alone.  */
  29606. +      sym->st_shndx = SHN_UNDEF;
  29607. +      /* If the symbol is weak, we do need to clear the value.
  29608. +         Otherwise, the PLT entry would provide a definition for
  29609. +         the symbol even if the symbol wasn't defined anywhere,
  29610. +         and so the symbol would never be NULL.  */
  29611. +      if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
  29612. +          == 0)
  29613. +        sym->st_value = 0;
  29614. +    }
  29615. +    }
  29616. +
  29617. +  if (h->got.offset != (bfd_vma) -1)
  29618. +    {
  29619. +      asection *sgot;
  29620. +      asection *srela;
  29621. +      Elf_Internal_Rela rela;
  29622. +
  29623. +      /* This symbol has an entry in the global offset table.  Set it
  29624. +         up.  */
  29625. +
  29626. +      sgot = bfd_get_section_by_name (dynobj, ".got");
  29627. +      srela = bfd_get_section_by_name (dynobj, ".rela.got");
  29628. +      BFD_ASSERT (sgot != NULL && srela != NULL);
  29629. +
  29630. +      rela.r_offset = (sgot->output_section->vma
  29631. +               + sgot->output_offset
  29632. +               + (h->got.offset &~ (bfd_vma) 1));
  29633. +
  29634. +      /* If this is a -Bsymbolic link, and the symbol is defined
  29635. +     locally, we just want to emit a RELATIVE reloc.  The entry in
  29636. +     the global offset table will already have been initialized in
  29637. +     the relocate_section function.  */
  29638. +      if (info->shared
  29639. +      && SYMBOL_REFERENCES_LOCAL (info, h))
  29640. +    {
  29641. +      rela.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
  29642. +      rela.r_addend = (h->root.u.def.value
  29643. +               + h->root.u.def.section->output_section->vma
  29644. +               + h->root.u.def.section->output_offset);
  29645. +    }
  29646. +      else
  29647. +    {
  29648. +      BFD_ASSERT ((h->got.offset & 1) == 0);
  29649. +      rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT);
  29650. +      rela.r_addend = 0;
  29651. +    }
  29652. +
  29653. +      bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
  29654. +      bfd_elf32_swap_reloca_out (output_bfd, &rela,
  29655. +                 ((Elf32_External_Rela *) srela->contents
  29656. +                  + srela->reloc_count));
  29657. +      ++srela->reloc_count;
  29658. +    }
  29659. +
  29660. +  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
  29661. +    {
  29662. +      asection *s;
  29663. +      Elf_Internal_Rela rela;
  29664. +
  29665. +      /* This symbols needs a copy reloc.  Set it up.  */
  29666. +
  29667. +#ifdef DEBUG
  29668. +      fprintf (stderr, ", copy");
  29669. +#endif
  29670. +
  29671. +      BFD_ASSERT (h->dynindx != -1);
  29672. +
  29673. +      if (h->size <= elf_gp_size (dynobj))
  29674. +    s = bfd_get_section_by_name (h->root.u.def.section->owner,
  29675. +                     ".rela.sbss");
  29676. +      else
  29677. +    s = bfd_get_section_by_name (h->root.u.def.section->owner,
  29678. +                     ".rela.bss");
  29679. +      BFD_ASSERT (s != NULL);
  29680. +
  29681. +      rela.r_offset = (h->root.u.def.value
  29682. +               + h->root.u.def.section->output_section->vma
  29683. +               + h->root.u.def.section->output_offset);
  29684. +      rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY);
  29685. +      rela.r_addend = 0;
  29686. +      bfd_elf32_swap_reloca_out (output_bfd, &rela,
  29687. +                 ((Elf32_External_Rela *) s->contents
  29688. +                  + s->reloc_count));
  29689. +      ++s->reloc_count;
  29690. +    }
  29691. +
  29692. +#ifdef DEBUG
  29693. +  fprintf (stderr, "\n");
  29694. +#endif
  29695. +
  29696. +  /* Mark some specially defined symbols as absolute.  */
  29697. +  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
  29698. +      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
  29699. +      || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
  29700. +    sym->st_shndx = SHN_ABS;
  29701. +
  29702. +  return true;
  29703. +}
  29704. +
  29705. +/* Finish up the dynamic sections.  */
  29706. +
  29707. +static boolean
  29708. +ppc_elf_finish_dynamic_sections (output_bfd, info)
  29709. +     bfd *output_bfd;
  29710. +     struct bfd_link_info *info;
  29711. +{
  29712. +  asection *sdyn;
  29713. +  bfd *dynobj = elf_hash_table (info)->dynobj;
  29714. +  asection *sgot = bfd_get_section_by_name (dynobj, ".got");
  29715. +
  29716. +#ifdef DEBUG
  29717. +  fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
  29718. +#endif
  29719. +
  29720. +  sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
  29721. +
  29722. +  if (elf_hash_table (info)->dynamic_sections_created)
  29723. +    {
  29724. +      asection *splt;
  29725. +      Elf32_External_Dyn *dyncon, *dynconend;
  29726. +
  29727. +      splt = bfd_get_section_by_name (dynobj, ".plt");
  29728. +      BFD_ASSERT (splt != NULL && sdyn != NULL);
  29729. +
  29730. +      dyncon = (Elf32_External_Dyn *) sdyn->contents;
  29731. +      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
  29732. +      for (; dyncon < dynconend; dyncon++)
  29733. +    {
  29734. +      Elf_Internal_Dyn dyn;
  29735. +      const char *name;
  29736. +      boolean size;
  29737. +
  29738. +      bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
  29739. +
  29740. +      switch (dyn.d_tag)
  29741. +        {
  29742. +        case DT_PLTGOT:   name = ".plt";      size = false; break;
  29743. +        case DT_PLTRELSZ: name = ".rela.plt"; size = true;  break;
  29744. +        case DT_JMPREL:   name = ".rela.plt"; size = false; break;
  29745. +        default:          name = NULL;      size = false; break;
  29746. +        }
  29747. +
  29748. +      if (name != NULL)
  29749. +        {
  29750. +          asection *s;
  29751. +
  29752. +          s = bfd_get_section_by_name (output_bfd, name);
  29753. +          if (s == NULL)
  29754. +        dyn.d_un.d_val = 0;
  29755. +          else
  29756. +        {
  29757. +          if (! size)
  29758. +            dyn.d_un.d_ptr = s->vma;
  29759. +          else
  29760. +            {
  29761. +              if (s->_cooked_size != 0)
  29762. +            dyn.d_un.d_val = s->_cooked_size;
  29763. +              else
  29764. +            dyn.d_un.d_val = s->_raw_size;
  29765. +            }
  29766. +        }
  29767. +          bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
  29768. +        }
  29769. +    }
  29770. +    }
  29771. +
  29772. +  /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can
  29773. +     easily find the address of the _GLOBAL_OFFSET_TABLE_.  */
  29774. +  if (sgot)
  29775. +    {
  29776. +      unsigned char *contents = sgot->contents;
  29777. +      bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents);
  29778. +
  29779. +      if (sdyn == NULL)
  29780. +    bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
  29781. +      else
  29782. +    bfd_put_32 (output_bfd,
  29783. +            sdyn->output_section->vma + sdyn->output_offset,
  29784. +            contents+4);
  29785. +
  29786. +      elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
  29787. +    }
  29788. +
  29789. +  return true;
  29790. +}
  29791. +
  29792. +/* The RELOCATE_SECTION function is called by the ELF backend linker
  29793. +   to handle the relocations for a section.
  29794. +
  29795. +   The relocs are always passed as Rela structures; if the section
  29796. +   actually uses Rel structures, the r_addend field will always be
  29797. +   zero.
  29798. +
  29799. +   This function is responsible for adjust the section contents as
  29800. +   necessary, and (if using Rela relocs and generating a
  29801. +   relocateable output file) adjusting the reloc addend as
  29802. +   necessary.
  29803. +
  29804. +   This function does not have to worry about setting the reloc
  29805. +   address or the reloc symbol index.
  29806. +
  29807. +   LOCAL_SYMS is a pointer to the swapped in local symbols.
  29808. +
  29809. +   LOCAL_SECTIONS is an array giving the section in the input file
  29810. +   corresponding to the st_shndx field of each local symbol.
  29811. +
  29812. +   The global hash table entry for the global symbols can be found
  29813. +   via elf_sym_hashes (input_bfd).
  29814. +
  29815. +   When generating relocateable output, this function must handle
  29816. +   STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
  29817. +   going to be the section symbol corresponding to the output
  29818. +   section, which means that the addend must be adjusted
  29819. +   accordingly.  */
  29820. +
  29821. +static boolean
  29822. +ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
  29823. +              contents, relocs, local_syms, local_sections)
  29824. +     bfd *output_bfd;
  29825. +     struct bfd_link_info *info;
  29826. +     bfd *input_bfd;
  29827. +     asection *input_section;
  29828. +     bfd_byte *contents;
  29829. +     Elf_Internal_Rela *relocs;
  29830. +     Elf_Internal_Sym *local_syms;
  29831. +     asection **local_sections;
  29832. +{
  29833. +  Elf_Internal_Shdr *symtab_hdr          = &elf_tdata (input_bfd)->symtab_hdr;
  29834. +  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
  29835. +  bfd *dynobj                  = elf_hash_table (info)->dynobj;
  29836. +  elf_linker_section_t *sdata          = (dynobj) ? elf_linker_section (dynobj, LINKER_SECTION_SDATA)  : NULL;
  29837. +  elf_linker_section_t *sdata2          = (dynobj) ? elf_linker_section (dynobj, LINKER_SECTION_SDATA2) : NULL;
  29838. +  Elf_Internal_Rela *rel          = relocs;
  29839. +  Elf_Internal_Rela *relend          = relocs + input_section->reloc_count;
  29840. +  asection *sreloc              = NULL;
  29841. +  asection *splt;
  29842. +  asection *sgot;
  29843. +  bfd_vma *local_got_offsets;
  29844. +  boolean ret                  = true;
  29845. +  long insn;
  29846. +  asection *sdata_sec                     = NULL;
  29847. +  asection *sbss_sec                     = NULL;
  29848. +
  29849. +#ifdef DEBUG
  29850. +  fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n",
  29851. +       bfd_archive_filename (input_bfd),
  29852. +       bfd_section_name(input_bfd, input_section),
  29853. +       (long) input_section->reloc_count,
  29854. +       (info->relocateable) ? " (relocatable)" : "");
  29855. +#endif
  29856. +
  29857. +  if (info->relocateable)
  29858. +    return true;
  29859. +
  29860. +  if (!ppc_elf_howto_table[R_PPC_ADDR32])
  29861. +    /* Initialize howto table if needed.  */
  29862. +    ppc_elf_howto_init ();
  29863. +
  29864. +  if (!strcmp(bfd_section_name(output_bfd, input_section), ".sdata") ||
  29865. +      !strcmp(bfd_section_name(output_bfd, input_section), ".sbss"))
  29866. +  {
  29867. +    sdata_sec = bfd_get_section_by_name(output_bfd, ".sdata");
  29868. +    if (sdata_sec)
  29869. +      sdata_sec = sdata_sec->output_section;
  29870. +    sbss_sec = bfd_get_section_by_name(output_bfd, ".sbss");
  29871. +    if (sbss_sec)
  29872. +      sbss_sec = sbss_sec->output_section;
  29873. +  }
  29874. +  local_got_offsets = elf_local_got_offsets (input_bfd);
  29875. +
  29876. +  splt = sgot = NULL;
  29877. +  if (dynobj != NULL)
  29878. +    {
  29879. +      splt = bfd_get_section_by_name (dynobj, ".plt");
  29880. +      sgot = bfd_get_section_by_name (dynobj, ".got");
  29881. +    }
  29882. +
  29883. +  for (; rel < relend; rel++)
  29884. +    {
  29885. +      enum elf_ppc_reloc_type r_type    = (enum elf_ppc_reloc_type)ELF32_R_TYPE (rel->r_info);
  29886. +      bfd_vma offset            = rel->r_offset;
  29887. +      bfd_vma addend            = rel->r_addend;
  29888. +      bfd_reloc_status_type r        = bfd_reloc_other;
  29889. +      Elf_Internal_Sym *sym        = (Elf_Internal_Sym *) 0;
  29890. +      asection *sec            = (asection *) 0;
  29891. +      struct elf_link_hash_entry *h    = (struct elf_link_hash_entry *) 0;
  29892. +      const char *sym_name        = (const char *) 0;
  29893. +      boolean copy                      = false;
  29894. +      reloc_howto_type *howto;
  29895. +      unsigned long r_symndx;
  29896. +      bfd_vma relocation;
  29897. +      int will_become_local;
  29898. +
  29899. +      /* Unknown relocation handling */
  29900. +      if ((unsigned) r_type >= (unsigned) R_PPC_max
  29901. +      || !ppc_elf_howto_table[(int) r_type])
  29902. +    {
  29903. +      (*_bfd_error_handler) (_("%s: unknown relocation type %d"),
  29904. +                 bfd_archive_filename (input_bfd),
  29905. +                 (int) r_type);
  29906. +
  29907. +      bfd_set_error (bfd_error_bad_value);
  29908. +      ret = false;
  29909. +      continue;
  29910. +    }
  29911. +
  29912. +      howto = ppc_elf_howto_table[(int) r_type];
  29913. +      r_symndx = ELF32_R_SYM (rel->r_info);
  29914. +
  29915. +      if (r_symndx < symtab_hdr->sh_info)
  29916. +    {
  29917. +      sym = local_syms + r_symndx;
  29918. +      sec = local_sections[r_symndx];
  29919. +      sym_name = "<local symbol>";
  29920. +
  29921. +      relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
  29922. +      addend = rel->r_addend;
  29923. +      /* Relocs to local symbols are always resolved.  */
  29924. +      will_become_local = 1;
  29925. +    }
  29926. +      else
  29927. +    {
  29928. +      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  29929. +      while (h->root.type == bfd_link_hash_indirect
  29930. +         || h->root.type == bfd_link_hash_warning)
  29931. +        h = (struct elf_link_hash_entry *) h->root.u.i.link;
  29932. +      sym_name = h->root.root.string;
  29933. +
  29934. +      /* Can this relocation be resolved immediately?  */
  29935. +      will_become_local = SYMBOL_REFERENCES_LOCAL (info, h);
  29936. +
  29937. +      if (h->root.type == bfd_link_hash_defined
  29938. +          || h->root.type == bfd_link_hash_defweak)
  29939. +        {
  29940. +          sec = h->root.u.def.section;
  29941. +          if (((r_type == R_PPC_PLT32
  29942. +            || r_type == R_PPC_PLTREL24)
  29943. +           && splt != NULL
  29944. +           && h->plt.offset != (bfd_vma) -1)
  29945. +          || (r_type == R_PPC_LOCAL24PC
  29946. +              && sec->output_section == NULL)
  29947. +          || ((r_type == R_PPC_GOT16
  29948. +               || r_type == R_PPC_GOT16_LO
  29949. +               || r_type == R_PPC_GOT16_HI
  29950. +               || r_type == R_PPC_GOT16_HA)
  29951. +              && elf_hash_table (info)->dynamic_sections_created
  29952. +              && (! info->shared || ! will_become_local))
  29953. +          || (info->shared
  29954. +               && ! will_become_local
  29955. +              && ((input_section->flags & SEC_ALLOC) != 0
  29956. +              /* Testing SEC_DEBUGGING here may be wrong.
  29957. +                             It's here to avoid a crash when
  29958. +                             generating a shared library with DWARF
  29959. +                             debugging information.  */
  29960. +              || ((input_section->flags & SEC_DEBUGGING) != 0
  29961. +                  && (h->elf_link_hash_flags
  29962. +                  & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
  29963. +              && (r_type == R_PPC_ADDR32
  29964. +              || r_type == R_PPC_ADDR24
  29965. +              || r_type == R_PPC_ADDR16
  29966. +              || r_type == R_PPC_ADDR16_LO
  29967. +              || r_type == R_PPC_ADDR16_HI
  29968. +              || r_type == R_PPC_ADDR16_HA
  29969. +              || r_type == R_PPC_ADDR14
  29970. +              || r_type == R_PPC_ADDR14_BRTAKEN
  29971. +              || r_type == R_PPC_ADDR14_BRNTAKEN
  29972. +              || r_type == R_PPC_COPY
  29973. +              || r_type == R_PPC_GLOB_DAT
  29974. +              || r_type == R_PPC_JMP_SLOT
  29975. +              || r_type == R_PPC_UADDR32
  29976. +              || r_type == R_PPC_UADDR16
  29977. +              || r_type == R_PPC_SDAREL16
  29978. +              || r_type == R_PPC_EMB_NADDR32
  29979. +              || r_type == R_PPC_EMB_NADDR16
  29980. +              || r_type == R_PPC_EMB_NADDR16_LO
  29981. +              || r_type == R_PPC_EMB_NADDR16_HI
  29982. +              || r_type == R_PPC_EMB_NADDR16_HA
  29983. +              || r_type == R_PPC_EMB_SDAI16
  29984. +              || r_type == R_PPC_EMB_SDA2I16
  29985. +              || r_type == R_PPC_EMB_SDA2REL
  29986. +              || r_type == R_PPC_EMB_SDA21
  29987. +              || r_type == R_PPC_EMB_MRKREF
  29988. +              || r_type == R_PPC_EMB_BIT_FLD
  29989. +              || r_type == R_PPC_EMB_RELSDA
  29990. +              || ((r_type == R_PPC_REL24
  29991. +                   || r_type == R_PPC_REL32
  29992. +                   || r_type == R_PPC_REL14
  29993. +                   || r_type == R_PPC_REL14_BRTAKEN
  29994. +                   || r_type == R_PPC_REL14_BRNTAKEN
  29995. +                   || r_type == R_PPC_RELATIVE)
  29996. +                  && strcmp (h->root.root.string,
  29997. +                     "_GLOBAL_OFFSET_TABLE_") != 0))))
  29998. +        {
  29999. +          /* In these cases, we don't need the relocation
  30000. +                     value.  We check specially because in some
  30001. +                     obscure cases sec->output_section will be NULL.  */
  30002. +          relocation = 0;
  30003. +        }
  30004. +          else if (sec->output_section == NULL)
  30005. +        {
  30006. +                  (*_bfd_error_handler)
  30007. +                    (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
  30008. +                     bfd_archive_filename (input_bfd), h->root.root.string,
  30009. +                     bfd_get_section_name (input_bfd, input_section));
  30010. +          relocation = 0;
  30011. +        }
  30012. +          else
  30013. +        relocation = (h->root.u.def.value
  30014. +                  + sec->output_section->vma
  30015. +                  + sec->output_offset);
  30016. +        }
  30017. +      else if (h->root.type == bfd_link_hash_undefweak)
  30018. +        relocation = 0;
  30019. +      else if (info->shared
  30020. +           && (!info->symbolic || info->allow_shlib_undefined)
  30021. +           && !info->no_undefined
  30022. +           && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
  30023. +        relocation = 0;
  30024. +      else
  30025. +        {
  30026. +          if (! (*info->callbacks->undefined_symbol) (info,
  30027. +                             h->root.root.string,
  30028. +                             input_bfd,
  30029. +                             input_section,
  30030. +                             rel->r_offset,
  30031. +                             (!info->shared
  30032. +                              || info->no_undefined
  30033. +                              || ELF_ST_VISIBILITY (h->other))))
  30034. +        return false;
  30035. +          relocation = 0;
  30036. +        }
  30037. +    }
  30038. +
  30039. +      switch ((int) r_type)
  30040. +    {
  30041. +    default:
  30042. +      (*_bfd_error_handler) (_("%s: unknown relocation type %d for symbol %s"),
  30043. +                 bfd_archive_filename (input_bfd),
  30044. +                 (int) r_type, sym_name);
  30045. +
  30046. +      bfd_set_error (bfd_error_bad_value);
  30047. +      ret = false;
  30048. +      continue;
  30049. +
  30050. +    case (int) R_PPC_NONE:
  30051. +      continue;
  30052. +
  30053. +    /* Relocations that need no special processing.  */
  30054. +    case (int) R_PPC_LOCAL24PC:
  30055. +      /* It makes no sense to point a local relocation
  30056. +         at a symbol not in this object.  */
  30057. +      if (h != NULL
  30058. +          && (h->root.type == bfd_link_hash_defined
  30059. +          || h->root.type == bfd_link_hash_defweak)
  30060. +          && sec->output_section == NULL)
  30061. +        {
  30062. +          if (! (*info->callbacks->undefined_symbol) (info,
  30063. +                              h->root.root.string,
  30064. +                              input_bfd,
  30065. +                              input_section,
  30066. +                              rel->r_offset,
  30067. +                              true))
  30068. +        return false;
  30069. +          continue;
  30070. +        }
  30071. +      break;
  30072. +
  30073. +    /* Relocations that may need to be propagated if this is a shared
  30074. +           object.  */
  30075. +    case (int) R_PPC_REL24:
  30076. +    case (int) R_PPC_REL32:
  30077. +    case (int) R_PPC_REL14:
  30078. +      /* If these relocations are not to a named symbol, they can be
  30079. +         handled right here, no need to bother the dynamic linker.  */
  30080. +      if (info->shared && (h == NULL
  30081. +          || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
  30082. +              || SYMBOL_REFERENCES_LOCAL (info, h)))
  30083. +        break;
  30084. +    /* fall through */
  30085. +
  30086. +    /* Relocations that always need to be propagated if this is a shared
  30087. +           object.  */
  30088. +    case (int) R_PPC_ADDR32:
  30089. +    case (int) R_PPC_ADDR24:
  30090. +    case (int) R_PPC_ADDR16:
  30091. +    case (int) R_PPC_ADDR16_LO:
  30092. +    case (int) R_PPC_ADDR16_HI:
  30093. +    case (int) R_PPC_ADDR16_HA:
  30094. +    case (int) R_PPC_ADDR14:
  30095. +    case (int) R_PPC_UADDR32:
  30096. +    case (int) R_PPC_UADDR16:
  30097. +      if (info->shared && r_symndx != 0)
  30098. +        {
  30099. +          Elf_Internal_Rela outrel;
  30100. +          int skip;
  30101. +
  30102. +#ifdef DEBUG
  30103. +          fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n",
  30104. +               (h && h->root.root.string) ? h->root.root.string : "<unknown>");
  30105. +#endif
  30106. +
  30107. +          /* When generating a shared object, these relocations
  30108. +                 are copied into the output file to be resolved at run
  30109. +                 time.  */
  30110. +
  30111. +          if (sreloc == NULL)
  30112. +        {
  30113. +          const char *name;
  30114. +
  30115. +          name = (bfd_elf_string_from_elf_section
  30116. +              (input_bfd,
  30117. +               elf_elfheader (input_bfd)->e_shstrndx,
  30118. +               elf_section_data (input_section)->rel_hdr.sh_name));
  30119. +          if (name == NULL)
  30120. +            return false;
  30121. +
  30122. +          BFD_ASSERT (strncmp (name, ".rela", 5) == 0
  30123. +                  && strcmp (bfd_get_section_name (input_bfd,
  30124. +                                   input_section),
  30125. +                     name + 5) == 0);
  30126. +
  30127. +          sreloc = bfd_get_section_by_name (dynobj, name);
  30128. +          BFD_ASSERT (sreloc != NULL);
  30129. +        }
  30130. +
  30131. +          skip = 0;
  30132. +
  30133. +          outrel.r_offset =
  30134. +        _bfd_elf_section_offset (output_bfd, info, input_section,
  30135. +                     rel->r_offset);
  30136. +          if (outrel.r_offset == (bfd_vma) -1
  30137. +          || outrel.r_offset == (bfd_vma) -2)
  30138. +        skip = (int) outrel.r_offset;
  30139. +          outrel.r_offset += (input_section->output_section->vma
  30140. +                  + input_section->output_offset);
  30141. +
  30142. +          if (skip)
  30143. +        memset (&outrel, 0, sizeof outrel);
  30144. +          /* h->dynindx may be -1 if this symbol was marked to
  30145. +                 become local.  */
  30146. +          else if (! will_become_local)
  30147. +        {
  30148. +          outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
  30149. +          outrel.r_addend = rel->r_addend;
  30150. +        }
  30151. +          else
  30152. +        {
  30153. +          if (r_type == R_PPC_ADDR32)
  30154. +            {
  30155. +              outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
  30156. +              outrel.r_addend = relocation + rel->r_addend;
  30157. +            }
  30158. +          else
  30159. +            {
  30160. +              long indx;
  30161. +
  30162. +              if (h == NULL)
  30163. +            sec = local_sections[r_symndx];
  30164. +              else
  30165. +            {
  30166. +              BFD_ASSERT (h->root.type == bfd_link_hash_defined
  30167. +                      || (h->root.type
  30168. +                      == bfd_link_hash_defweak));
  30169. +              sec = h->root.u.def.section;
  30170. +            }
  30171. +              if (sec != NULL && bfd_is_abs_section (sec))
  30172. +            indx = 0;
  30173. +              else if (sec == NULL || sec->owner == NULL)
  30174. +            {
  30175. +              bfd_set_error (bfd_error_bad_value);
  30176. +              return false;
  30177. +            }
  30178. +              else
  30179. +            {
  30180. +              asection *osec;
  30181. +
  30182. +              osec = sec->output_section;
  30183. +              indx = elf_section_data (osec)->dynindx;
  30184. +              BFD_ASSERT (indx > 0);
  30185. +#ifdef DEBUG
  30186. +              if (indx <= 0)
  30187. +                {
  30188. +                  printf ("indx=%d section=%s flags=%08x name=%s\n",
  30189. +                     indx, osec->name, osec->flags,
  30190. +                     h->root.root.string);
  30191. +                }
  30192. +#endif
  30193. +            }
  30194. +
  30195. +              outrel.r_info = ELF32_R_INFO (indx, r_type);
  30196. +              outrel.r_addend = relocation + rel->r_addend;
  30197. +            }
  30198. +        }
  30199. +
  30200. +          bfd_elf32_swap_reloca_out (output_bfd, &outrel,
  30201. +                     (((Elf32_External_Rela *)
  30202. +                       sreloc->contents)
  30203. +                      + sreloc->reloc_count));
  30204. +          ++sreloc->reloc_count;
  30205. +
  30206. +          if (skip == -1)
  30207. +        continue;
  30208. +
  30209. +          /* This reloc will be computed at runtime.  We clear the memory
  30210. +         so that it contains predictable value.  */
  30211. +          if (! skip
  30212. +          && ((input_section->flags & SEC_ALLOC) != 0
  30213. +              || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE))
  30214. +        {
  30215. +          relocation = howto->pc_relative ? outrel.r_offset : 0;
  30216. +          addend = 0;
  30217. +          break;
  30218. +        }
  30219. +        }
  30220. +      else if (r_type == R_PPC_REL24 || r_type == R_PPC_REL14)
  30221. +        {
  30222. +          if (sec->output_section != input_section->output_section)
  30223. +        {
  30224. +          (*_bfd_error_handler) ("%s: The target (%s) of a %s relocation is in the wrong section (%s)",
  30225. +                     bfd_get_filename (input_bfd),
  30226. +                     sym_name,
  30227. +                     ppc_elf_howto_table[ (int)r_type ]->name,
  30228. +                     bfd_get_section_name (abfd, sec));
  30229. +          bfd_set_error (bfd_error_bad_value);
  30230. +          ret = false;
  30231. +          continue;     
  30232. +        }
  30233. +          break;
  30234. +        }
  30235. +      else if (r_type == R_PPC_REL32)
  30236. +        {
  30237. +          if (sec->output_section != input_section->output_section)
  30238. +        copy = true;
  30239. +          else
  30240. +        break;
  30241. +        }
  30242. +      else if (ddr_ptr && sec && r_type == R_PPC_ADDR32 && 
  30243. +           (sec->output_section == sdata_sec ||
  30244. +            sec->output_section == sbss_sec ||
  30245. +            !strcmp(bfd_get_section_name(abfd, sec), "COMMON") ||
  30246. +            !strcmp(bfd_get_section_name(abfd, sec), ".data") ||
  30247. +            !strcmp(bfd_get_section_name(abfd, sec), ".bss")) &&
  30248. +           (input_section->output_section == sdata_sec ||
  30249. +            input_section->output_section == sbss_sec ||
  30250. +            !strcmp(bfd_get_section_name(abfd, input_section), "COMMON") ||
  30251. +            !strcmp(bfd_get_section_name(abfd, input_section), ".data") ||
  30252. +            !strcmp(bfd_get_section_name(abfd, input_section), ".bss")))
  30253. +        {
  30254. +          ++ddr_count;
  30255. +          *ddr_ptr++ = input_section->output_offset + offset;
  30256. +          copy = true;
  30257. +          break;
  30258. +        }
  30259. +      else if (sec && !bfd_is_abs_section(sec))
  30260. +        {
  30261. +          copy = true;
  30262. +          break;
  30263. +        }
  30264. +
  30265. +      if (copy && ddr_ptr && sec &&
  30266. +          (sec->output_section == sdata_sec ||
  30267. +           sec->output_section == sbss_sec ||
  30268. +           !strcmp(bfd_get_section_name(abfd, sec), "COMMON") ||
  30269. +           !strcmp(bfd_get_section_name(abfd, sec), ".data") ||
  30270. +           !strcmp(bfd_get_section_name(abfd, sec), ".bss")) /*&&
  30271. +          (r_type != R_PPC_ADDR32 ||
  30272. +           !(input_section->output_section == sdata_sec->output_section ||
  30273. +         input_section->output_section == sbss_sec->output_section ||
  30274. +         !strcmp(bfd_get_section_name(abfd, input_section), "COMMON") ||
  30275. +         !strcmp(bfd_get_section_name(abfd, input_section), ".data") ||
  30276. +         !strcmp(bfd_get_section_name(abfd, input_section), ".bss")))*/)
  30277. +        {
  30278. +          (*_bfd_error_handler) ("%s: The target (%s) of a %s relocation is in the wrong section (%s)",
  30279. +                     bfd_get_filename (input_bfd),
  30280. +                     sym_name,
  30281. +                     ppc_elf_howto_table[ (int)r_type ]->name,
  30282. +                     bfd_get_section_name (abfd, sec));
  30283. +          bfd_set_error (bfd_error_bad_value);
  30284. +          ret = false;
  30285. +          continue;        
  30286. +        }
  30287. +
  30288. +      /* Arithmetic adjust relocations that aren't going into a
  30289. +         shared object.  */
  30290. +      if (r_type == R_PPC_ADDR16_HA
  30291. +          /* It's just possible that this symbol is a weak symbol
  30292. +         that's not actually defined anywhere. In that case,
  30293. +         'sec' would be NULL, and we should leave the symbol
  30294. +         alone (it will be set to zero elsewhere in the link).  */
  30295. +          && sec != NULL)
  30296. +        {
  30297. +          addend += ((relocation + addend) & 0x8000) << 1;
  30298. +        }
  30299. +      break;
  30300. +
  30301. +    /* branch taken prediction relocations */
  30302. +    case (int) R_PPC_ADDR14_BRTAKEN:
  30303. +    case (int) R_PPC_REL14_BRTAKEN:
  30304. +      insn = bfd_get_32 (output_bfd, contents + offset);
  30305. +      if ((relocation - offset) & 0x8000)
  30306. +        insn &= ~BRANCH_PREDICT_BIT;
  30307. +      else
  30308. +        insn |= BRANCH_PREDICT_BIT;
  30309. +      bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
  30310. +      break;
  30311. +
  30312. +    /* branch not taken predicition relocations */
  30313. +    case (int) R_PPC_ADDR14_BRNTAKEN:
  30314. +    case (int) R_PPC_REL14_BRNTAKEN:
  30315. +      insn = bfd_get_32 (output_bfd, contents + offset);
  30316. +      if ((relocation - offset) & 0x8000)
  30317. +        insn |= BRANCH_PREDICT_BIT;
  30318. +      else
  30319. +        insn &= ~BRANCH_PREDICT_BIT;
  30320. +      bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
  30321. +      break;
  30322. +
  30323. +    /* GOT16 relocations */
  30324. +    case (int) R_PPC_GOT16:
  30325. +    case (int) R_PPC_GOT16_LO:
  30326. +    case (int) R_PPC_GOT16_HI:
  30327. +    case (int) R_PPC_GOT16_HA:
  30328. +      /* Relocation is to the entry for this symbol in the global
  30329. +             offset table.  */
  30330. +      BFD_ASSERT (sgot != NULL);
  30331. +
  30332. +      if (h != NULL)
  30333. +        {
  30334. +          bfd_vma off;
  30335. +
  30336. +          off = h->got.offset;
  30337. +          BFD_ASSERT (off != (bfd_vma) -1);
  30338. +
  30339. +          if (! elf_hash_table (info)->dynamic_sections_created
  30340. +          || (info->shared
  30341. +              && SYMBOL_REFERENCES_LOCAL (info, h)))
  30342. +        {
  30343. +          /* This is actually a static link, or it is a
  30344. +                     -Bsymbolic link and the symbol is defined
  30345. +                     locally.  We must initialize this entry in the
  30346. +                     global offset table.  Since the offset must
  30347. +                     always be a multiple of 4, we use the least
  30348. +                     significant bit to record whether we have
  30349. +                     initialized it already.
  30350. +
  30351. +             When doing a dynamic link, we create a .rela.got
  30352. +             relocation entry to initialize the value.  This
  30353. +             is done in the finish_dynamic_symbol routine.  */
  30354. +          if ((off & 1) != 0)
  30355. +            off &= ~1;
  30356. +          else
  30357. +            {
  30358. +              bfd_put_32 (output_bfd, relocation,
  30359. +                  sgot->contents + off);
  30360. +              h->got.offset |= 1;
  30361. +            }
  30362. +        }
  30363. +
  30364. +          relocation = sgot->output_offset + off - 4;
  30365. +        }
  30366. +      else
  30367. +        {
  30368. +          bfd_vma off;
  30369. +
  30370. +          BFD_ASSERT (local_got_offsets != NULL
  30371. +              && local_got_offsets[r_symndx] != (bfd_vma) -1);
  30372. +
  30373. +          off = local_got_offsets[r_symndx];
  30374. +
  30375. +          /* The offset must always be a multiple of 4.  We use
  30376. +         the least significant bit to record whether we have
  30377. +         already processed this entry.  */
  30378. +          if ((off & 1) != 0)
  30379. +        off &= ~1;
  30380. +          else
  30381. +        {
  30382. +
  30383. +          if (info->shared)
  30384. +            {
  30385. +              asection *srelgot;
  30386. +              Elf_Internal_Rela outrel;
  30387. +
  30388. +              /* We need to generate a R_PPC_RELATIVE reloc
  30389. +             for the dynamic linker.  */
  30390. +              srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
  30391. +              BFD_ASSERT (srelgot != NULL);
  30392. +
  30393. +              outrel.r_offset = (sgot->output_section->vma
  30394. +                     + sgot->output_offset
  30395. +                     + off);
  30396. +              outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
  30397. +              outrel.r_addend = relocation;
  30398. +              bfd_elf32_swap_reloca_out (output_bfd, &outrel,
  30399. +                         (((Elf32_External_Rela *)
  30400. +                           srelgot->contents)
  30401. +                          + srelgot->reloc_count));
  30402. +              ++srelgot->reloc_count;
  30403. +              relocation = 0;
  30404. +            }
  30405. +
  30406. +          bfd_put_32 (output_bfd, relocation, sgot->contents + off);
  30407. +          local_got_offsets[r_symndx] |= 1;
  30408. +        }
  30409. +
  30410. +          relocation = sgot->output_offset + off - 4;
  30411. +        }
  30412. +      break;
  30413. +
  30414. +    /* Indirect .sdata relocation */
  30415. +    case (int) R_PPC_EMB_SDAI16:
  30416. +      BFD_ASSERT (sdata != NULL);
  30417. +      relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
  30418. +                                sdata, h, relocation, rel,
  30419. +                                R_PPC_RELATIVE);
  30420. +      break;
  30421. +
  30422. +    /* Indirect .sdata2 relocation */
  30423. +    case (int) R_PPC_EMB_SDA2I16:
  30424. +      BFD_ASSERT (sdata2 != NULL);
  30425. +      relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
  30426. +                                sdata2, h, relocation, rel,
  30427. +                                R_PPC_RELATIVE);
  30428. +      break;
  30429. +
  30430. +    /* Handle the TOC16 reloc.  We want to use the offset within the .got
  30431. +       section, not the actual VMA.  This is appropriate when generating
  30432. +       an embedded ELF object, for which the .got section acts like the
  30433. +       AIX .toc section.  */
  30434. +    case (int) R_PPC_TOC16:            /* phony GOT16 relocations */
  30435. +      BFD_ASSERT (sec != (asection *) 0);
  30436. +      BFD_ASSERT (bfd_is_und_section (sec)
  30437. +              || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
  30438. +              || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0)
  30439. +
  30440. +      addend -= sec->output_section->vma + sec->output_offset + 0x8000;
  30441. +      break;
  30442. +
  30443. +    case (int) R_PPC_PLTREL24:
  30444. +      /* Relocation is to the entry for this symbol in the
  30445. +             procedure linkage table.  */
  30446. +      BFD_ASSERT (h != NULL);
  30447. +
  30448. +      if (h->plt.offset == (bfd_vma) -1
  30449. +          || splt == NULL)
  30450. +        {
  30451. +          /* We didn't make a PLT entry for this symbol.  This
  30452. +                 happens when statically linking PIC code, or when
  30453. +                 using -Bsymbolic.  */
  30454. +          break;
  30455. +        }
  30456. +
  30457. +      relocation = (splt->output_section->vma
  30458. +            + splt->output_offset
  30459. +            + h->plt.offset);
  30460. +      break;
  30461. +
  30462. +    /* relocate against _SDA_BASE_ */
  30463. +    case (int) R_PPC_SDAREL16:
  30464. +      {
  30465. +        const char *name;
  30466. +
  30467. +        BFD_ASSERT (sec != (asection *) 0);
  30468. +        name = bfd_get_section_name (abfd, sec->output_section);
  30469. +        if (strcmp (name, ".sdata") != 0
  30470. +        && strcmp (name, ".sbss") != 0)
  30471. +          {
  30472. +        (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
  30473. +                       bfd_archive_filename (input_bfd),
  30474. +                       sym_name,
  30475. +                       ppc_elf_howto_table[(int) r_type]->name,
  30476. +                       name);
  30477. +          }
  30478. +        addend -= (sdata->sym_hash->root.u.def.value
  30479. +               + sdata->sym_hash->root.u.def.section->output_section->vma
  30480. +               /*+ sdata->sym_hash->root.u.def.section->output_offset*/);
  30481. +      }
  30482. +      break;
  30483. +
  30484. +    /* relocate against _SDA_BASE_, in large data mode */
  30485. +    case (int)R_PPC_MORPHOS_DREL:
  30486. +    case (int)R_PPC_MORPHOS_DREL_LO:
  30487. +    case (int)R_PPC_MORPHOS_DREL_HI:
  30488. +    case (int)R_PPC_MORPHOS_DREL_HA:
  30489. +      BFD_ASSERT (sec != (asection *)0);
  30490. +      if (strcmp (bfd_get_section_name (abfd, sec), ".sdata") != 0
  30491. +          && strcmp (bfd_get_section_name (abfd, sec), ".data") != 0
  30492. +          && strcmp (bfd_get_section_name (abfd, sec), ".bss") != 0
  30493. +          && strcmp (bfd_get_section_name (abfd, sec), ".sbss") != 0
  30494. +          && strcmp (bfd_get_section_name (abfd, sec), "COMMON") != 0)
  30495. +        {
  30496. +          (*_bfd_error_handler) ("%s: The target (%s) of a %s relocation is in the wrong section (%s)",
  30497. +                     bfd_get_filename (input_bfd),
  30498. +                     sym_name,
  30499. +                     ppc_elf_howto_table[ (int)r_type ]->name,
  30500. +                     bfd_get_section_name (abfd, sec));
  30501. +
  30502. +          bfd_set_error (bfd_error_bad_value);
  30503. +          ret = false;
  30504. +          continue;
  30505. +        }
  30506. +      /*printf("DREL: addend = %x, sdata->val = %x, vma = %x, output_offset = %x\n",
  30507. +         addend, sdata->sym_hash->root.u.def.value,
  30508. +         sdata->sym_hash->root.u.def.section->output_section->vma,
  30509. +         sdata->sym_hash->root.u.def.section->output_offset);*/
  30510. +      addend -= (sdata->sym_hash->root.u.def.value
  30511. +             + sdata->sym_hash->root.u.def.section->output_section->vma
  30512. +             /*+ sdata->sym_hash->root.u.def.section->output_offset*/);
  30513. +      if (r_type == R_PPC_MORPHOS_DREL_HA)
  30514. +        addend += ((relocation + addend) & 0x8000) << 1;
  30515. +      break;
  30516. +      
  30517. +    /* relocate against _SDA2_BASE_ */
  30518. +    case (int) R_PPC_EMB_SDA2REL:
  30519. +      {
  30520. +        const char *name;
  30521. +
  30522. +        BFD_ASSERT (sec != (asection *) 0);
  30523. +        name = bfd_get_section_name (abfd, sec->output_section);
  30524. +        if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0)
  30525. +          {
  30526. +        (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
  30527. +                       bfd_archive_filename (input_bfd),
  30528. +                       sym_name,
  30529. +                       ppc_elf_howto_table[(int) r_type]->name,
  30530. +                       name);
  30531. +
  30532. +        bfd_set_error (bfd_error_bad_value);
  30533. +        ret = false;
  30534. +        continue;
  30535. +          }
  30536. +        addend -= (sdata2->sym_hash->root.u.def.value
  30537. +               + sdata2->sym_hash->root.u.def.section->output_section->vma
  30538. +               + sdata2->sym_hash->root.u.def.section->output_offset);
  30539. +      }
  30540. +      break;
  30541. +
  30542. +    /* relocate against either _SDA_BASE_, _SDA2_BASE_, or 0 */
  30543. +    case (int) R_PPC_EMB_SDA21:
  30544. +    case (int) R_PPC_EMB_RELSDA:
  30545. +      {
  30546. +        const char *name;
  30547. +        int reg;
  30548. +
  30549. +        BFD_ASSERT (sec != (asection *) 0);
  30550. +        name = bfd_get_section_name (abfd, sec->output_section);
  30551. +        if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)
  30552. +          {
  30553. +        reg = 13;
  30554. +        addend -= (sdata->sym_hash->root.u.def.value
  30555. +               + sdata->sym_hash->root.u.def.section->output_section->vma
  30556. +               + sdata->sym_hash->root.u.def.section->output_offset);
  30557. +          }
  30558. +
  30559. +        else if (strcmp (name, ".sdata2") == 0
  30560. +             || strcmp (name, ".sbss2") == 0)
  30561. +          {
  30562. +        reg = 2;
  30563. +        addend -= (sdata2->sym_hash->root.u.def.value
  30564. +               + sdata2->sym_hash->root.u.def.section->output_section->vma
  30565. +               + sdata2->sym_hash->root.u.def.section->output_offset);
  30566. +          }
  30567. +
  30568. +        else if (strcmp (name, ".PPC.EMB.sdata0") == 0
  30569. +             || strcmp (name, ".PPC.EMB.sbss0") == 0)
  30570. +          {
  30571. +        reg = 0;
  30572. +          }
  30573. +
  30574. +        else
  30575. +          {
  30576. +        (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
  30577. +                       bfd_archive_filename (input_bfd),
  30578. +                       sym_name,
  30579. +                       ppc_elf_howto_table[(int) r_type]->name,
  30580. +                       name);
  30581. +
  30582. +        bfd_set_error (bfd_error_bad_value);
  30583. +        ret = false;
  30584. +        continue;
  30585. +          }
  30586. +
  30587. +        if (r_type == R_PPC_EMB_SDA21)
  30588. +          {            /* fill in register field */
  30589. +        insn = bfd_get_32 (output_bfd, contents + offset);
  30590. +        insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
  30591. +        bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
  30592. +          }
  30593. +      }
  30594. +      break;
  30595. +
  30596. +    /* Relocate against the beginning of the section */
  30597. +    case (int) R_PPC_SECTOFF:
  30598. +    case (int) R_PPC_SECTOFF_LO:
  30599. +    case (int) R_PPC_SECTOFF_HI:
  30600. +      BFD_ASSERT (sec != (asection *) 0);
  30601. +      addend -= sec->output_section->vma;
  30602. +      break;
  30603. +
  30604. +    case (int) R_PPC_SECTOFF_HA:
  30605. +      BFD_ASSERT (sec != (asection *) 0);
  30606. +      addend -= sec->output_section->vma;
  30607. +      addend += ((relocation + addend) & 0x8000) << 1;
  30608. +      break;
  30609. +
  30610. +    /* Negative relocations */
  30611. +    case (int) R_PPC_EMB_NADDR32:
  30612. +    case (int) R_PPC_EMB_NADDR16:
  30613. +    case (int) R_PPC_EMB_NADDR16_LO:
  30614. +    case (int) R_PPC_EMB_NADDR16_HI:
  30615. +      addend -= 2 * relocation;
  30616. +      break;
  30617. +
  30618. +    case (int) R_PPC_EMB_NADDR16_HA:
  30619. +      addend -= 2 * relocation;
  30620. +      addend += ((relocation + addend) & 0x8000) << 1;
  30621. +      break;
  30622. +
  30623. +    /* NOP relocation that prevents garbage collecting linkers from omitting a
  30624. +       reference.  */
  30625. +    case (int) R_PPC_EMB_MRKREF:
  30626. +      continue;
  30627. +
  30628. +    case (int) R_PPC_COPY:
  30629. +    case (int) R_PPC_GLOB_DAT:
  30630. +    case (int) R_PPC_JMP_SLOT:
  30631. +    case (int) R_PPC_RELATIVE:
  30632. +    case (int) R_PPC_PLT32:
  30633. +    case (int) R_PPC_PLTREL32:
  30634. +    case (int) R_PPC_PLT16_LO:
  30635. +    case (int) R_PPC_PLT16_HI:
  30636. +    case (int) R_PPC_PLT16_HA:
  30637. +    case (int) R_PPC_EMB_RELSEC16:
  30638. +    case (int) R_PPC_EMB_RELST_LO:
  30639. +    case (int) R_PPC_EMB_RELST_HI:
  30640. +    case (int) R_PPC_EMB_RELST_HA:
  30641. +    case (int) R_PPC_EMB_BIT_FLD:
  30642. +      (*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."),
  30643. +                 bfd_archive_filename (input_bfd),
  30644. +                 ppc_elf_howto_table[(int) r_type]->name,
  30645. +                 sym_name);
  30646. +
  30647. +      bfd_set_error (bfd_error_invalid_operation);
  30648. +      ret = false;
  30649. +      continue;
  30650. +
  30651. +    case (int) R_PPC_GNU_VTINHERIT:
  30652. +    case (int) R_PPC_GNU_VTENTRY:
  30653. +      /* These are no-ops in the end.  */
  30654. +      continue;
  30655. +    }
  30656. +
  30657. +#ifdef DEBUG
  30658. +      fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n",
  30659. +           howto->name,
  30660. +           (int) r_type,
  30661. +           sym_name,
  30662. +           r_symndx,
  30663. +           (long) offset,
  30664. +           (long) addend);
  30665. +#endif
  30666. +      if (copy) 
  30667. +    {
  30668. +      Elf_Internal_Rela outrel;
  30669. +
  30670. +      if (sec == NULL) /* Don't know if it is possible... */ 
  30671. +        abort(); 
  30672. +
  30673. +      /*printf("copying reloc %d, addend=%x, rel=%x, indx=%d, offset=%x, sec_vma=%x\n",
  30674. +         r_type,addend,relocation,sec->output_section->target_index,
  30675. +         sec->output_offset,sec->output_section->vma);*/
  30676. +
  30677. +      outrel.r_info = ELF32_R_INFO(sec->output_section->target_index, r_type);
  30678. +      outrel.r_addend = relocation + addend - sec->output_section->vma;
  30679. +      outrel.r_offset = input_section->output_offset + offset;
  30680. +
  30681. +       bfd_elf32_swap_reloca_out (output_bfd, &outrel,
  30682. +                     (((Elf32_External_Rela *)
  30683. +                       elf_section_data(input_section->output_section)->
  30684. +                       rel_hdr.contents)
  30685. +                      + input_section->output_section->reloc_count));
  30686. +      ++input_section->output_section->reloc_count;
  30687. +    }
  30688. +      else
  30689. +    {
  30690. +      /*printf("applying reloc %d, sym=%s addend=%x, rel=%x, indx=%d, offset=%x, sec_vma=%x\n",
  30691. +         r_type,sym_name,addend,relocation,sec->output_section->target_index,
  30692. +         sec->output_offset,sec->output_section->vma);*/
  30693. +
  30694. +      r = _bfd_final_link_relocate (howto,
  30695. +                    input_bfd,
  30696. +                    input_section,
  30697. +                    contents,
  30698. +                    offset,
  30699. +                    relocation,
  30700. +                    addend);
  30701. +
  30702. +      if (r == bfd_reloc_ok)
  30703. +    ;
  30704. +      else if (r == bfd_reloc_overflow)
  30705. +    {
  30706. +      const char *name;
  30707. +
  30708. +      if (h != NULL)
  30709. +        {
  30710. +          if (h->root.type == bfd_link_hash_undefweak
  30711. +          && howto->pc_relative)
  30712. +        {
  30713. +          /* Assume this is a call protected by other code that
  30714. +             detect the symbol is undefined.  If this is the case,
  30715. +             we can safely ignore the overflow.  If not, the
  30716. +             program is hosed anyway, and a little warning isn't
  30717. +             going to help.  */
  30718. +
  30719. +          continue;
  30720. +        }
  30721. +
  30722. +          name = h->root.root.string;
  30723. +        }
  30724. +      else
  30725. +        {
  30726. +          name = bfd_elf_string_from_elf_section (input_bfd,
  30727. +                              symtab_hdr->sh_link,
  30728. +                              sym->st_name);
  30729. +          if (name == NULL)
  30730. +        continue;
  30731. +          if (*name == '\0')
  30732. +        name = bfd_section_name (input_bfd, sec);
  30733. +        }
  30734. +
  30735. +      if (! (*info->callbacks->reloc_overflow) (info,
  30736. +                           name,
  30737. +                           howto->name,
  30738. +                           (bfd_vma) 0,
  30739. +                           input_bfd,
  30740. +                           input_section,
  30741. +                           offset))
  30742. +        return false;
  30743. +    }
  30744. +      else
  30745. +    ret = false;
  30746. +    }
  30747. +    }
  30748. +
  30749. +#ifdef DEBUG
  30750. +  fprintf (stderr, "\n");
  30751. +#endif
  30752. +
  30753. +  return ret;
  30754. +}
  30755. +
  30756. +static enum elf_reloc_type_class
  30757. +ppc_elf_reloc_type_class (rela)
  30758. +     const Elf_Internal_Rela *rela;
  30759. +{
  30760. +  switch ((int) ELF32_R_TYPE (rela->r_info))
  30761. +    {
  30762. +    case R_PPC_RELATIVE:
  30763. +      return reloc_class_relative;
  30764. +    case R_PPC_REL24:
  30765. +    case R_PPC_ADDR24:
  30766. +    case R_PPC_JMP_SLOT:
  30767. +      return reloc_class_plt;
  30768. +    case R_PPC_COPY:
  30769. +      return reloc_class_copy;
  30770. +    default:
  30771. +      return reloc_class_normal;
  30772. +    }
  30773. +}
  30774. +
  30775. +/* Support for core dump NOTE sections */
  30776. +static boolean
  30777. +ppc_elf_grok_prstatus (abfd, note)
  30778. +     bfd *abfd;
  30779. +     Elf_Internal_Note *note;
  30780. +{
  30781. +  int offset;
  30782. +  unsigned int raw_size;
  30783. +
  30784. +  switch (note->descsz)
  30785. +    {
  30786. +      default:
  30787. +    return false;
  30788. +
  30789. +      case 268:        /* Linux/PPC */
  30790. +    /* pr_cursig */
  30791. +    elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
  30792. +
  30793. +    /* pr_pid */
  30794. +    elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
  30795. +
  30796. +    /* pr_reg */
  30797. +    offset = 72;
  30798. +    raw_size = 192;
  30799. +
  30800. +    break;
  30801. +    }
  30802. +
  30803. +  /* Make a ".reg/999" section.  */
  30804. +  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
  30805. +                      raw_size, note->descpos + offset);
  30806. +}
  30807. +
  30808. +static boolean
  30809. +ppc_elf_grok_psinfo (abfd, note)
  30810. +     bfd *abfd;
  30811. +     Elf_Internal_Note *note;
  30812. +{
  30813. +  switch (note->descsz)
  30814. +    {
  30815. +      default:
  30816. +    return false;
  30817. +
  30818. +      case 128:        /* Linux/PPC elf_prpsinfo */
  30819. +    elf_tdata (abfd)->core_program
  30820. +     = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
  30821. +    elf_tdata (abfd)->core_command
  30822. +     = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
  30823. +    }
  30824. +
  30825. +  /* Note that for some reason, a spurious space is tacked
  30826. +     onto the end of the args in some (at least one anyway)
  30827. +     implementations, so strip it off if it exists.  */
  30828. +
  30829. +  {
  30830. +    char *command = elf_tdata (abfd)->core_command;
  30831. +    int n = strlen (command);
  30832. +
  30833. +    if (0 < n && command[n - 1] == ' ')
  30834. +      command[n - 1] = '\0';
  30835. +  }
  30836. +
  30837. +  return true;
  30838. +}
  30839. +
  30840. +/* Special MorphOS final link routine.  */
  30841. +/* This is almost the same as the elf one, except for the hanling of relocations */
  30842. +
  30843. +/* A structure we use to avoid passing large numbers of arguments.  */
  30844. +
  30845. +struct elf_final_link_info
  30846. +{
  30847. +  /* General link information.  */
  30848. +  struct bfd_link_info *info;
  30849. +  /* Output BFD.  */
  30850. +  bfd *output_bfd;
  30851. +  /* Symbol string table.  */
  30852. +  struct bfd_strtab_hash *symstrtab;
  30853. +  /* .dynsym section.  */
  30854. +  asection *dynsym_sec;
  30855. +  /* .hash section.  */
  30856. +  asection *hash_sec;
  30857. +  /* symbol version section (.gnu.version).  */
  30858. +  asection *symver_sec;
  30859. +  /* first SHF_TLS section (if any).  */
  30860. +  asection *first_tls_sec;
  30861. +  /* Buffer large enough to hold contents of any section.  */
  30862. +  bfd_byte *contents;
  30863. +  /* Buffer large enough to hold external relocs of any section.  */
  30864. +  PTR external_relocs;
  30865. +  /* Buffer large enough to hold internal relocs of any section.  */
  30866. +  Elf_Internal_Rela *internal_relocs;
  30867. +  /* Buffer large enough to hold external local symbols of any input
  30868. +     BFD.  */
  30869. +  Elf_External_Sym *external_syms;
  30870. +  /* And a buffer for symbol section indices.  */
  30871. +  Elf_External_Sym_Shndx *locsym_shndx;
  30872. +  /* Buffer large enough to hold internal local symbols of any input
  30873. +     BFD.  */
  30874. +  Elf_Internal_Sym *internal_syms;
  30875. +  /* Array large enough to hold a symbol index for each local symbol
  30876. +     of any input BFD.  */
  30877. +  long *indices;
  30878. +  /* Array large enough to hold a section pointer for each local
  30879. +     symbol of any input BFD.  */
  30880. +  asection **sections;
  30881. +  /* Buffer to hold swapped out symbols.  */
  30882. +  Elf_External_Sym *symbuf;
  30883. +  /* And one for symbol section indices.  */
  30884. +  Elf_External_Sym_Shndx *symshndxbuf;
  30885. +  /* Number of swapped out symbols in buffer.  */
  30886. +  size_t symbuf_count;
  30887. +  /* Number of symbols which fit in symbuf.  */
  30888. +  size_t symbuf_size;
  30889. +};
  30890. +
  30891. +static boolean elf_link_output_sym
  30892. +  PARAMS ((struct elf_final_link_info *, const char *,
  30893. +       Elf_Internal_Sym *, asection *));
  30894. +static boolean elf_link_flush_output_syms
  30895. +  PARAMS ((struct elf_final_link_info *));
  30896. +static boolean elf_link_output_extsym
  30897. +  PARAMS ((struct elf_link_hash_entry *, PTR));
  30898. +static boolean elf_link_sec_merge_syms
  30899. +  PARAMS ((struct elf_link_hash_entry *, PTR));
  30900. +static boolean elf_link_check_versioned_symbol
  30901. +  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
  30902. +static boolean elf_link_input_bfd
  30903. +  PARAMS ((struct elf_final_link_info *, bfd *));
  30904. +static boolean elf_reloc_link_order
  30905. +  PARAMS ((bfd *, struct bfd_link_info *, asection *,
  30906. +       struct bfd_link_order *));
  30907. +
  30908. +static boolean elf_section_ignore_discarded_relocs
  30909. +  PARAMS ((asection *));
  30910. +
  30911. +/* This struct is used to pass information to elf_link_output_extsym.  */
  30912. +
  30913. +struct elf_outext_info
  30914. +{
  30915. +  boolean failed;
  30916. +  boolean localsyms;
  30917. +  struct elf_final_link_info *finfo;
  30918. +};
  30919. +
  30920. +/* Compute the size of, and allocate space for, REL_HDR which is the
  30921. +   section header for a section containing relocations for O.  */
  30922. +
  30923. +static boolean
  30924. +elf_link_size_reloc_section (abfd, rel_hdr, o)
  30925. +     bfd *abfd;
  30926. +     Elf_Internal_Shdr *rel_hdr;
  30927. +     asection *o;
  30928. +{
  30929. +  bfd_size_type reloc_count;
  30930. +  bfd_size_type num_rel_hashes;
  30931. +
  30932. +  /* Figure out how many relocations there will be.  */
  30933. +  if (rel_hdr == &elf_section_data (o)->rel_hdr)
  30934. +    reloc_count = elf_section_data (o)->rel_count;
  30935. +  else
  30936. +    reloc_count = elf_section_data (o)->rel_count2;
  30937. +
  30938. +  num_rel_hashes = o->reloc_count;
  30939. +  if (num_rel_hashes < reloc_count)
  30940. +    num_rel_hashes = reloc_count;
  30941. +
  30942. +  /* That allows us to calculate the size of the section.  */
  30943. +  rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
  30944. +
  30945. +  /* The contents field must last into write_object_contents, so we
  30946. +     allocate it with bfd_alloc rather than malloc.  Also since we
  30947. +     cannot be sure that the contents will actually be filled in,
  30948. +     we zero the allocated space.  */
  30949. +  rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size);
  30950. +  if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
  30951. +    return false;
  30952. +
  30953. +  /* We only allocate one set of hash entries, so we only do it the
  30954. +     first time we are called.  */
  30955. +  if (elf_section_data (o)->rel_hashes == NULL
  30956. +      && num_rel_hashes)
  30957. +    {
  30958. +      struct elf_link_hash_entry **p;
  30959. +
  30960. +      p = ((struct elf_link_hash_entry **)
  30961. +       bfd_zmalloc (num_rel_hashes
  30962. +            * sizeof (struct elf_link_hash_entry *)));
  30963. +      if (p == NULL)
  30964. +    return false;
  30965. +
  30966. +      elf_section_data (o)->rel_hashes = p;
  30967. +    }
  30968. +
  30969. +  return true;
  30970. +}
  30971. +
  30972. +/* When performing a relocateable link, the input relocations are
  30973. +   preserved.  But, if they reference global symbols, the indices
  30974. +   referenced must be updated.  Update all the relocations in
  30975. +   REL_HDR (there are COUNT of them), using the data in REL_HASH.  */
  30976. +
  30977. +static void
  30978. +elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
  30979. +     bfd *abfd;
  30980. +     Elf_Internal_Shdr *rel_hdr;
  30981. +     unsigned int count;
  30982. +     struct elf_link_hash_entry **rel_hash;
  30983. +{
  30984. +  unsigned int i;
  30985. +  struct elf_backend_data *bed = get_elf_backend_data (abfd);
  30986. +  Elf_Internal_Rel *irel;
  30987. +  Elf_Internal_Rela *irela;
  30988. +  bfd_size_type amt = sizeof (Elf_Internal_Rel) * bed->s->int_rels_per_ext_rel;
  30989. +
  30990. +  irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
  30991. +  if (irel == NULL)
  30992. +    {
  30993. +      (*_bfd_error_handler) (_("Error: out of memory"));
  30994. +      abort ();
  30995. +    }
  30996. +
  30997. +  amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
  30998. +  irela = (Elf_Internal_Rela *) bfd_zmalloc (amt);
  30999. +  if (irela == NULL)
  31000. +    {
  31001. +      (*_bfd_error_handler) (_("Error: out of memory"));
  31002. +      abort ();
  31003. +    }
  31004. +
  31005. +  for (i = 0; i < count; i++, rel_hash++)
  31006. +    {
  31007. +      if (*rel_hash == NULL)
  31008. +    continue;
  31009. +
  31010. +      BFD_ASSERT ((*rel_hash)->indx >= 0);
  31011. +
  31012. +      if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
  31013. +    {
  31014. +      Elf_External_Rel *erel;
  31015. +      unsigned int j;
  31016. +
  31017. +      erel = (Elf_External_Rel *) rel_hdr->contents + i;
  31018. +      if (bed->s->swap_reloc_in)
  31019. +        (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
  31020. +      else
  31021. +        elf_swap_reloc_in (abfd, erel, irel);
  31022. +
  31023. +      for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
  31024. +        irel[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
  31025. +                     ELF_R_TYPE (irel[j].r_info));
  31026. +
  31027. +      if (bed->s->swap_reloc_out)
  31028. +        (*bed->s->swap_reloc_out) (abfd, irel, (bfd_byte *) erel);
  31029. +      else
  31030. +        elf_swap_reloc_out (abfd, irel, erel);
  31031. +    }
  31032. +      else
  31033. +    {
  31034. +      Elf_External_Rela *erela;
  31035. +      unsigned int j;
  31036. +
  31037. +      BFD_ASSERT (rel_hdr->sh_entsize
  31038. +              == sizeof (Elf_External_Rela));
  31039. +
  31040. +      erela = (Elf_External_Rela *) rel_hdr->contents + i;
  31041. +      if (bed->s->swap_reloca_in)
  31042. +        (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
  31043. +      else
  31044. +        elf_swap_reloca_in (abfd, erela, irela);
  31045. +
  31046. +      for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
  31047. +        irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
  31048. +                      ELF_R_TYPE (irela[j].r_info));
  31049. +
  31050. +      if (bed->s->swap_reloca_out)
  31051. +        (*bed->s->swap_reloca_out) (abfd, irela, (bfd_byte *) erela);
  31052. +      else
  31053. +        elf_swap_reloca_out (abfd, irela, erela);
  31054. +    }
  31055. +    }
  31056. +
  31057. +  free (irel);
  31058. +  free (irela);
  31059. +}
  31060. +
  31061. +struct elf_link_sort_rela
  31062. +{
  31063. +  bfd_vma offset;
  31064. +  enum elf_reloc_type_class type;
  31065. +  union
  31066. +  {
  31067. +    Elf_Internal_Rel rel;
  31068. +    Elf_Internal_Rela rela;
  31069. +  } u;
  31070. +};
  31071. +
  31072. +static int
  31073. +elf_link_sort_cmp1 (A, B)
  31074. +     const PTR A;
  31075. +     const PTR B;
  31076. +{
  31077. +  struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
  31078. +  struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
  31079. +  int relativea, relativeb;
  31080. +
  31081. +  relativea = a->type == reloc_class_relative;
  31082. +  relativeb = b->type == reloc_class_relative;
  31083. +
  31084. +  if (relativea < relativeb)
  31085. +    return 1;
  31086. +  if (relativea > relativeb)
  31087. +    return -1;
  31088. +  if (ELF_R_SYM (a->u.rel.r_info) < ELF_R_SYM (b->u.rel.r_info))
  31089. +    return -1;
  31090. +  if (ELF_R_SYM (a->u.rel.r_info) > ELF_R_SYM (b->u.rel.r_info))
  31091. +    return 1;
  31092. +  if (a->u.rel.r_offset < b->u.rel.r_offset)
  31093. +    return -1;
  31094. +  if (a->u.rel.r_offset > b->u.rel.r_offset)
  31095. +    return 1;
  31096. +  return 0;
  31097. +}
  31098. +
  31099. +static int
  31100. +elf_link_sort_cmp2 (A, B)
  31101. +     const PTR A;
  31102. +     const PTR B;
  31103. +{
  31104. +  struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
  31105. +  struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
  31106. +  int copya, copyb;
  31107. +
  31108. +  if (a->offset < b->offset)
  31109. +    return -1;
  31110. +  if (a->offset > b->offset)
  31111. +    return 1;
  31112. +  copya = (a->type == reloc_class_copy) * 2 + (a->type == reloc_class_plt);
  31113. +  copyb = (b->type == reloc_class_copy) * 2 + (b->type == reloc_class_plt);
  31114. +  if (copya < copyb)
  31115. +    return -1;
  31116. +  if (copya > copyb)
  31117. +    return 1;
  31118. +  if (a->u.rel.r_offset < b->u.rel.r_offset)
  31119. +    return -1;
  31120. +  if (a->u.rel.r_offset > b->u.rel.r_offset)
  31121. +    return 1;
  31122. +  return 0;
  31123. +}
  31124. +
  31125. +static size_t
  31126. +elf_link_sort_relocs (abfd, info, psec)
  31127. +     bfd *abfd;
  31128. +     struct bfd_link_info *info;
  31129. +     asection **psec;
  31130. +{
  31131. +  bfd *dynobj = elf_hash_table (info)->dynobj;
  31132. +  asection *reldyn, *o;
  31133. +  boolean rel = false;
  31134. +  bfd_size_type count, size;
  31135. +  size_t i, j, ret;
  31136. +  struct elf_link_sort_rela *rela;
  31137. +  struct elf_backend_data *bed = get_elf_backend_data (abfd);
  31138. +
  31139. +  reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
  31140. +  if (reldyn == NULL || reldyn->_raw_size == 0)
  31141. +    {
  31142. +      reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
  31143. +      if (reldyn == NULL || reldyn->_raw_size == 0)
  31144. +    return 0;
  31145. +      rel = true;
  31146. +      count = reldyn->_raw_size / sizeof (Elf_External_Rel);
  31147. +    }
  31148. +  else
  31149. +    count = reldyn->_raw_size / sizeof (Elf_External_Rela);
  31150. +
  31151. +  size = 0;
  31152. +  for (o = dynobj->sections; o != NULL; o = o->next)
  31153. +    if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
  31154. +    == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
  31155. +    && o->output_section == reldyn)
  31156. +      size += o->_raw_size;
  31157. +
  31158. +  if (size != reldyn->_raw_size)
  31159. +    return 0;
  31160. +
  31161. +  rela = (struct elf_link_sort_rela *) bfd_zmalloc (sizeof (*rela) * count);
  31162. +  if (rela == NULL)
  31163. +    {
  31164. +      (*info->callbacks->warning)
  31165. +    (info, _("Not enough memory to sort relocations"), 0, abfd, 0,
  31166. +     (bfd_vma) 0);
  31167. +      return 0;
  31168. +    }
  31169. +
  31170. +  for (o = dynobj->sections; o != NULL; o = o->next)
  31171. +    if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
  31172. +    == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
  31173. +    && o->output_section == reldyn)
  31174. +      {
  31175. +    if (rel)
  31176. +      {
  31177. +        Elf_External_Rel *erel, *erelend;
  31178. +        struct elf_link_sort_rela *s;
  31179. +
  31180. +        erel = (Elf_External_Rel *) o->contents;
  31181. +        erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
  31182. +        s = rela + o->output_offset / sizeof (Elf_External_Rel);
  31183. +        for (; erel < erelend; erel++, s++)
  31184. +          {
  31185. +        if (bed->s->swap_reloc_in)
  31186. +          (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, &s->u.rel);
  31187. +        else
  31188. +          elf_swap_reloc_in (abfd, erel, &s->u.rel);
  31189. +
  31190. +        s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
  31191. +          }
  31192. +      }
  31193. +    else
  31194. +      {
  31195. +        Elf_External_Rela *erela, *erelaend;
  31196. +        struct elf_link_sort_rela *s;
  31197. +
  31198. +        erela = (Elf_External_Rela *) o->contents;
  31199. +        erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
  31200. +        s = rela + o->output_offset / sizeof (Elf_External_Rela);
  31201. +        for (; erela < erelaend; erela++, s++)
  31202. +          {
  31203. +        if (bed->s->swap_reloca_in)
  31204. +          (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela,
  31205. +                         &s->u.rela);
  31206. +        else
  31207. +          elf_swap_reloca_in (dynobj, erela, &s->u.rela);
  31208. +
  31209. +        s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
  31210. +          }
  31211. +      }
  31212. +      }
  31213. +
  31214. +  qsort (rela, (size_t) count, sizeof (*rela), elf_link_sort_cmp1);
  31215. +  for (ret = 0; ret < count && rela[ret].type == reloc_class_relative; ret++)
  31216. +    ;
  31217. +  for (i = ret, j = ret; i < count; i++)
  31218. +    {
  31219. +      if (ELF_R_SYM (rela[i].u.rel.r_info) != ELF_R_SYM (rela[j].u.rel.r_info))
  31220. +    j = i;
  31221. +      rela[i].offset = rela[j].u.rel.r_offset;
  31222. +    }
  31223. +  qsort (rela + ret, (size_t) count - ret, sizeof (*rela), elf_link_sort_cmp2);
  31224. +
  31225. +  for (o = dynobj->sections; o != NULL; o = o->next)
  31226. +    if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
  31227. +    == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
  31228. +    && o->output_section == reldyn)
  31229. +      {
  31230. +    if (rel)
  31231. +      {
  31232. +        Elf_External_Rel *erel, *erelend;
  31233. +        struct elf_link_sort_rela *s;
  31234. +
  31235. +        erel = (Elf_External_Rel *) o->contents;
  31236. +        erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
  31237. +        s = rela + o->output_offset / sizeof (Elf_External_Rel);
  31238. +        for (; erel < erelend; erel++, s++)
  31239. +          {
  31240. +        if (bed->s->swap_reloc_out)
  31241. +          (*bed->s->swap_reloc_out) (abfd, &s->u.rel,
  31242. +                         (bfd_byte *) erel);
  31243. +        else
  31244. +          elf_swap_reloc_out (abfd, &s->u.rel, erel);
  31245. +          }
  31246. +      }
  31247. +    else
  31248. +      {
  31249. +        Elf_External_Rela *erela, *erelaend;
  31250. +        struct elf_link_sort_rela *s;
  31251. +
  31252. +        erela = (Elf_External_Rela *) o->contents;
  31253. +        erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
  31254. +        s = rela + o->output_offset / sizeof (Elf_External_Rela);
  31255. +        for (; erela < erelaend; erela++, s++)
  31256. +          {
  31257. +        if (bed->s->swap_reloca_out)
  31258. +          (*bed->s->swap_reloca_out) (dynobj, &s->u.rela,
  31259. +                          (bfd_byte *) erela);
  31260. +        else
  31261. +          elf_swap_reloca_out (dynobj, &s->u.rela, erela);
  31262. +          }
  31263. +      }
  31264. +      }
  31265. +
  31266. +  free (rela);
  31267. +  *psec = reldyn;
  31268. +  return ret;
  31269. +}
  31270. +
  31271. +/* Do the final step of an ELF link.  */
  31272. +
  31273. +boolean
  31274. +ppc_elf_final_link (abfd, info)
  31275. +     bfd *abfd;
  31276. +     struct bfd_link_info *info;
  31277. +{
  31278. +  boolean dynamic;
  31279. +  boolean emit_relocs;
  31280. +  bfd *dynobj;
  31281. +  struct elf_final_link_info finfo;
  31282. +  register asection *o;
  31283. +  register struct bfd_link_order *p;
  31284. +  register bfd *sub;
  31285. +  bfd_size_type max_contents_size;
  31286. +  bfd_size_type max_external_reloc_size;
  31287. +  bfd_size_type max_internal_reloc_count;
  31288. +  bfd_size_type max_sym_count;
  31289. +  bfd_size_type max_sym_shndx_count;
  31290. +  bfd_size_type max_datadata_reloc_count;
  31291. +  file_ptr off;
  31292. +  Elf_Internal_Sym elfsym;
  31293. +  unsigned int i;
  31294. +  Elf_Internal_Shdr *symtab_hdr;
  31295. +  Elf_Internal_Shdr *symstrtab_hdr;
  31296. +  struct elf_backend_data *bed = get_elf_backend_data (abfd);
  31297. +  struct elf_outext_info eoinfo;
  31298. +  boolean merged;
  31299. +  size_t relativecount = 0;
  31300. +  asection *reldyn = 0;
  31301. +  bfd_size_type amt;
  31302. +  asection *ddr_sec;
  31303. +  asection *sdata_sec = NULL;
  31304. +  asection *sbss_sec = NULL;
  31305. +
  31306. +  if (! is_elf_hash_table (info))
  31307. +    return false;
  31308. +
  31309. +  if (info->shared)
  31310. +    abfd->flags |= DYNAMIC;
  31311. +
  31312. +  bfd_set_start_address(abfd, 0);
  31313. +
  31314. +  dynamic = elf_hash_table (info)->dynamic_sections_created;
  31315. +  dynobj = elf_hash_table (info)->dynobj;
  31316. +
  31317. +  emit_relocs = (info->relocateable
  31318. +         || info->emitrelocations
  31319. +         || bed->elf_backend_emit_relocs);
  31320. +
  31321. +  finfo.info = info;
  31322. +  finfo.output_bfd = abfd;
  31323. +  finfo.symstrtab = elf_stringtab_init ();
  31324. +  if (finfo.symstrtab == NULL)
  31325. +    return false;
  31326. +
  31327. +  if (! dynamic)
  31328. +    {
  31329. +      finfo.dynsym_sec = NULL;
  31330. +      finfo.hash_sec = NULL;
  31331. +      finfo.symver_sec = NULL;
  31332. +    }
  31333. +  else
  31334. +    {
  31335. +      finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
  31336. +      finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
  31337. +      BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
  31338. +      finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
  31339. +      /* Note that it is OK if symver_sec is NULL.  */
  31340. +    }
  31341. +
  31342. +  finfo.contents = NULL;
  31343. +  finfo.external_relocs = NULL;
  31344. +  finfo.internal_relocs = NULL;
  31345. +  finfo.external_syms = NULL;
  31346. +  finfo.locsym_shndx = NULL;
  31347. +  finfo.internal_syms = NULL;
  31348. +  finfo.indices = NULL;
  31349. +  finfo.sections = NULL;
  31350. +  finfo.symbuf = NULL;
  31351. +  finfo.symshndxbuf = NULL;
  31352. +  finfo.symbuf_count = 0;
  31353. +  finfo.first_tls_sec = NULL;
  31354. +  for (o = abfd->sections; o != (asection *) NULL; o = o->next)
  31355. +    if ((o->flags & SEC_THREAD_LOCAL) != 0
  31356. +    && (o->flags & SEC_LOAD) != 0)
  31357. +      {
  31358. +    finfo.first_tls_sec = o;
  31359. +    break;
  31360. +      }
  31361. +
  31362. +  ddr_sec = bfd_get_section_by_name(abfd, "ddrelocs");
  31363. +  
  31364. +  /* Count up the number of relocations we will output for each output
  31365. +     section, so that we know the sizes of the reloc sections.  We
  31366. +     also figure out some maximum sizes.  */
  31367. +  max_contents_size = 0;
  31368. +  max_external_reloc_size = 0;
  31369. +  max_internal_reloc_count = 0;
  31370. +  max_sym_count = 0;
  31371. +  max_sym_shndx_count = 0;
  31372. +  max_datadata_reloc_count = 0;
  31373. +  merged = false;
  31374. +  for (o = abfd->sections; o != (asection *) NULL; o = o->next)
  31375. +    {
  31376. +      o->reloc_count = 0;
  31377. +
  31378. +      for (p = o->link_order_head; p != NULL; p = p->next)
  31379. +    {
  31380. +      if (p->type == bfd_section_reloc_link_order
  31381. +          || p->type == bfd_symbol_reloc_link_order)
  31382. +        ++o->reloc_count;
  31383. +      else if (p->type == bfd_indirect_link_order)
  31384. +        {
  31385. +          asection *sec;
  31386. +
  31387. +          sec = p->u.indirect.section;
  31388. +
  31389. +          /* Mark all sections which are to be included in the
  31390. +         link.  This will normally be every section.  We need
  31391. +         to do this so that we can identify any sections which
  31392. +         the linker has decided to not include.  */
  31393. +          sec->linker_mark = true;
  31394. +
  31395. +          if (sec->flags & SEC_MERGE)
  31396. +        merged = true;
  31397. +
  31398. +          /* Maximum number of relocations */
  31399. +          if (1 || info->relocateable || info->emitrelocations)
  31400. +        o->reloc_count += sec->reloc_count;
  31401. +          else if (bed->elf_backend_count_relocs)
  31402. +        {
  31403. +          Elf_Internal_Rela * relocs;
  31404. +
  31405. +          relocs = (NAME(_bfd_elf,link_read_relocs)
  31406. +                (abfd, sec, (PTR) NULL,
  31407. +                 (Elf_Internal_Rela *) NULL, info->keep_memory));
  31408. +
  31409. +          o->reloc_count
  31410. +            += (*bed->elf_backend_count_relocs) (sec, relocs);
  31411. +
  31412. +          if (elf_section_data (o)->relocs != relocs)
  31413. +            free (relocs);
  31414. +        }
  31415. +
  31416. +          if (sec->_raw_size > max_contents_size)
  31417. +        max_contents_size = sec->_raw_size;
  31418. +          if (sec->_cooked_size > max_contents_size)
  31419. +        max_contents_size = sec->_cooked_size;
  31420. +
  31421. +          /* We are interested in just local symbols, not all
  31422. +         symbols.  */
  31423. +          if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
  31424. +          && (sec->owner->flags & DYNAMIC) == 0)
  31425. +        {
  31426. +          size_t sym_count;
  31427. +
  31428. +          if (elf_bad_symtab (sec->owner))
  31429. +            sym_count = (elf_tdata (sec->owner)->symtab_hdr.sh_size
  31430. +                 / sizeof (Elf_External_Sym));
  31431. +          else
  31432. +            sym_count = elf_tdata (sec->owner)->symtab_hdr.sh_info;
  31433. +
  31434. +          if (sym_count > max_sym_count)
  31435. +            max_sym_count = sym_count;
  31436. +
  31437. +          if (sym_count > max_sym_shndx_count
  31438. +              && elf_symtab_shndx (sec->owner) != 0)
  31439. +            max_sym_shndx_count = sym_count;
  31440. +
  31441. +          if ((sec->flags & SEC_RELOC) != 0)
  31442. +            {
  31443. +              size_t ext_size;
  31444. +
  31445. +              ext_size = elf_section_data (sec)->rel_hdr.sh_size;
  31446. +              if (ext_size > max_external_reloc_size)
  31447. +            max_external_reloc_size = ext_size;
  31448. +              if (sec->reloc_count > max_internal_reloc_count)
  31449. +            max_internal_reloc_count = sec->reloc_count;
  31450. +            }
  31451. +        }
  31452. +        }
  31453. +    }
  31454. +
  31455. +      if (!strcmp(bfd_section_name(abfd, o), ".sdata"))
  31456. +    sdata_sec = o;
  31457. +      else if(!strcmp(bfd_section_name(abfd, o), ".sbss"))
  31458. +    sbss_sec = o;
  31459. +      else
  31460. +    bfd_set_section_vma(abfd, o, 0);
  31461. +
  31462. +      if (o->reloc_count > 0)
  31463. +        {
  31464. +      o->flags |= SEC_RELOC;
  31465. +      if (o == sdata_sec || o == sbss_sec)
  31466. +        max_datadata_reloc_count += o->reloc_count;
  31467. +    }
  31468. +      else
  31469. +    {
  31470. +      /* Explicitly clear the SEC_RELOC flag.  The linker tends to
  31471. +         set it (this is probably a bug) and if it is set
  31472. +         assign_section_numbers will create a reloc section.  */
  31473. +      o->flags &=~ SEC_RELOC;
  31474. +    }
  31475. +
  31476. +      /* If the SEC_ALLOC flag is not set, force the section VMA to
  31477. +     zero.  This is done in elf_fake_sections as well, but forcing
  31478. +     the VMA to 0 here will ensure that relocs against these
  31479. +     sections are handled correctly.  */
  31480. +      if ((o->flags & SEC_ALLOC) == 0
  31481. +      && ! o->user_set_vma)
  31482. +    o->vma = 0;
  31483. +    }
  31484. +
  31485. +  if (sdata_sec)
  31486. +    {
  31487. +      if (sbss_sec)
  31488. +    bfd_set_section_vma(abfd, sbss_sec, sbss_sec->vma - sdata_sec->vma);
  31489. +      bfd_set_section_vma(abfd, sdata_sec, 0);
  31490. +    }
  31491. +  
  31492. +  if (! info->relocateable && merged)
  31493. +    elf_link_hash_traverse (elf_hash_table (info),
  31494. +                elf_link_sec_merge_syms, (PTR) abfd);
  31495. +
  31496. +  /* Figure out the file positions for everything but the symbol table
  31497. +     and the relocs.  We set symcount to force assign_section_numbers
  31498. +     to create a symbol table.  */
  31499. +  bfd_get_symcount (abfd) = 1;
  31500. +  BFD_ASSERT (! abfd->output_has_begun);
  31501. +  if (! _bfd_elf_compute_section_file_positions (abfd, info))
  31502. +    goto error_return;
  31503. +
  31504. +  /* Figure out how many relocations we will have in each section.
  31505. +     Just using RELOC_COUNT isn't good enough since that doesn't
  31506. +     maintain a separate value for REL vs. RELA relocations.  */
  31507. +  if (emit_relocs)
  31508. +    for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
  31509. +      for (o = sub->sections; o != NULL; o = o->next)
  31510. +    {
  31511. +      asection *output_section;
  31512. +
  31513. +      if (! o->linker_mark)
  31514. +        {
  31515. +          /* This section was omitted from the link.  */
  31516. +          continue;
  31517. +        }
  31518. +
  31519. +      output_section = o->output_section;
  31520. +
  31521. +      if (output_section != NULL
  31522. +          && (o->flags & SEC_RELOC) != 0)
  31523. +        {
  31524. +          struct bfd_elf_section_data *esdi
  31525. +        = elf_section_data (o);
  31526. +          struct bfd_elf_section_data *esdo
  31527. +        = elf_section_data (output_section);
  31528. +          unsigned int *rel_count;
  31529. +          unsigned int *rel_count2;
  31530. +          bfd_size_type entsize;
  31531. +          bfd_size_type entsize2;
  31532. +
  31533. +          /* We must be careful to add the relocations from the
  31534. +         input section to the right output count.  */
  31535. +          entsize = esdi->rel_hdr.sh_entsize;
  31536. +          entsize2 = esdi->rel_hdr2 ? esdi->rel_hdr2->sh_entsize : 0;
  31537. +          BFD_ASSERT ((entsize == sizeof (Elf_External_Rel)
  31538. +               || entsize == sizeof (Elf_External_Rela))
  31539. +              && entsize2 != entsize
  31540. +              && (entsize2 == 0
  31541. +                  || entsize2 == sizeof (Elf_External_Rel)
  31542. +                  || entsize2 == sizeof (Elf_External_Rela)));
  31543. +          if (entsize == esdo->rel_hdr.sh_entsize)
  31544. +        {
  31545. +          rel_count = &esdo->rel_count;
  31546. +          rel_count2 = &esdo->rel_count2;
  31547. +        }
  31548. +          else
  31549. +        {
  31550. +          rel_count = &esdo->rel_count2;
  31551. +          rel_count2 = &esdo->rel_count;
  31552. +        }
  31553. +
  31554. +          *rel_count += NUM_SHDR_ENTRIES (& esdi->rel_hdr);
  31555. +          if (esdi->rel_hdr2)
  31556. +        *rel_count2 += NUM_SHDR_ENTRIES (esdi->rel_hdr2);
  31557. +          output_section->flags |= SEC_RELOC;
  31558. +        }
  31559. +    }
  31560. +
  31561. +  /* That created the reloc sections.  Set their sizes, and assign
  31562. +     them file positions, and allocate some buffers.  */
  31563. +  for (o = abfd->sections; o != NULL; o = o->next)
  31564. +    {
  31565. +      if ((o->flags & SEC_RELOC) != 0)
  31566. +    {
  31567. +      if (!elf_link_size_reloc_section (abfd,
  31568. +                        &elf_section_data (o)->rel_hdr,
  31569. +                        o))
  31570. +        goto error_return;
  31571. +
  31572. +      if (elf_section_data (o)->rel_hdr2
  31573. +          && !elf_link_size_reloc_section (abfd,
  31574. +                           elf_section_data (o)->rel_hdr2,
  31575. +                           o))
  31576. +        goto error_return;
  31577. +    }
  31578. +
  31579. +      /* Now, reset REL_COUNT and REL_COUNT2 so that we can use them
  31580. +     to count upwards while actually outputting the relocations.  */
  31581. +      elf_section_data (o)->rel_count = 0;
  31582. +      elf_section_data (o)->rel_count2 = 0;
  31583. +    }
  31584. +
  31585. +  /* We have now assigned file positions for all the sections except
  31586. +     relocations, .symtab, and .strtab.  We start the .symtab section
  31587. +     at the current file position, and write directly to it.  We build
  31588. +     the .strtab section in memory.  */
  31589. +  bfd_get_symcount (abfd) = 0;
  31590. +  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  31591. +  /* sh_name is set in prep_headers.  */
  31592. +  symtab_hdr->sh_type = SHT_SYMTAB;
  31593. +  symtab_hdr->sh_flags = 0;
  31594. +  symtab_hdr->sh_addr = 0;
  31595. +  symtab_hdr->sh_size = 0;
  31596. +  symtab_hdr->sh_entsize = sizeof (Elf_External_Sym);
  31597. +  /* sh_link is set in assign_section_numbers.  */
  31598. +  /* sh_info is set below.  */
  31599. +  /* sh_offset is set just below.  */
  31600. +  symtab_hdr->sh_addralign = bed->s->file_align;
  31601. +
  31602. +  off = elf_tdata (abfd)->next_file_pos;
  31603. +  off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, true);
  31604. +
  31605. +  /* Note that at this point elf_tdata (abfd)->next_file_pos is
  31606. +     incorrect.  We do not yet know the size of the .symtab section.
  31607. +     We correct next_file_pos below, after we do know the size.  */
  31608. +
  31609. +  /* Allocate a buffer to hold swapped out symbols.  This is to avoid
  31610. +     continuously seeking to the right position in the file.  */
  31611. +  if (! info->keep_memory || max_sym_count < 20)
  31612. +    finfo.symbuf_size = 20;
  31613. +  else
  31614. +    finfo.symbuf_size = max_sym_count;
  31615. +  amt = finfo.symbuf_size;
  31616. +  amt *= sizeof (Elf_External_Sym);
  31617. +  finfo.symbuf = (Elf_External_Sym *) bfd_malloc (amt);
  31618. +  if (finfo.symbuf == NULL)
  31619. +    goto error_return;
  31620. +  if (elf_numsections (abfd) > SHN_LORESERVE)
  31621. +    {
  31622. +      amt = finfo.symbuf_size;
  31623. +      amt *= sizeof (Elf_External_Sym_Shndx);
  31624. +      finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
  31625. +      if (finfo.symshndxbuf == NULL)
  31626. +    goto error_return;
  31627. +    }
  31628. +
  31629. +  /* Start writing out the symbol table.  The first symbol is always a
  31630. +     dummy symbol.  */
  31631. +  elfsym.st_value = 0;
  31632. +  elfsym.st_size = 0;
  31633. +  elfsym.st_info = 0;
  31634. +  elfsym.st_other = 0;
  31635. +  elfsym.st_shndx = SHN_UNDEF;
  31636. +  if (! elf_link_output_sym (&finfo, (const char *) NULL,
  31637. +                 &elfsym, bfd_und_section_ptr))
  31638. +    goto error_return;
  31639. +
  31640. +#if 0
  31641. +  /* Some standard ELF linkers do this, but we don't because it causes
  31642. +     bootstrap comparison failures.  */
  31643. +  /* Output a file symbol for the output file as the second symbol.
  31644. +     We output this even if we are discarding local symbols, although
  31645. +     I'm not sure if this is correct.  */
  31646. +  elfsym.st_value = 0;
  31647. +  elfsym.st_size = 0;
  31648. +  elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
  31649. +  elfsym.st_other = 0;
  31650. +  elfsym.st_shndx = SHN_ABS;
  31651. +  if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd),
  31652. +                 &elfsym, bfd_abs_section_ptr))
  31653. +    goto error_return;
  31654. +#endif
  31655. +
  31656. +  /* Output a symbol for each section.  We output these even if we are
  31657. +     discarding local symbols, since they are used for relocs.  These
  31658. +     symbols have no names.  We store the index of each one in the
  31659. +     index field of the section, so that we can find it again when
  31660. +     outputting relocs.  */
  31661. +  elfsym.st_size = 0;
  31662. +  elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
  31663. +  elfsym.st_other = 0;
  31664. +  for (i = 1; i < elf_numsections (abfd); i++)
  31665. +    {
  31666. +      o = section_from_elf_index (abfd, i);
  31667. +      if (o != NULL)
  31668. +    o->target_index = bfd_get_symcount (abfd);
  31669. +      elfsym.st_shndx = i;
  31670. +      elfsym.st_value = 0;
  31671. +      if (! elf_link_output_sym (&finfo, (const char *) NULL,
  31672. +                 &elfsym, o))
  31673. +    goto error_return;
  31674. +      if (i == SHN_LORESERVE)
  31675. +    i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
  31676. +    }
  31677. +
  31678. +  /* Allocate some memory to hold information read in from the input
  31679. +     files.  */
  31680. +  if (max_contents_size != 0)
  31681. +    {
  31682. +      finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
  31683. +      if (finfo.contents == NULL)
  31684. +    goto error_return;
  31685. +    }
  31686. +
  31687. +  if (max_external_reloc_size != 0)
  31688. +    {
  31689. +      finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size);
  31690. +      if (finfo.external_relocs == NULL)
  31691. +    goto error_return;
  31692. +    }
  31693. +
  31694. +  if (max_internal_reloc_count != 0)
  31695. +    {
  31696. +      amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
  31697. +      amt *= sizeof (Elf_Internal_Rela);
  31698. +      finfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
  31699. +      if (finfo.internal_relocs == NULL)
  31700. +    goto error_return;
  31701. +    }
  31702. +
  31703. +  if (max_sym_count != 0)
  31704. +    {
  31705. +      amt = max_sym_count * sizeof (Elf_External_Sym);
  31706. +      finfo.external_syms = (Elf_External_Sym *) bfd_malloc (amt);
  31707. +      if (finfo.external_syms == NULL)
  31708. +    goto error_return;
  31709. +
  31710. +      amt = max_sym_count * sizeof (Elf_Internal_Sym);
  31711. +      finfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt);
  31712. +      if (finfo.internal_syms == NULL)
  31713. +    goto error_return;
  31714. +
  31715. +      amt = max_sym_count * sizeof (long);
  31716. +      finfo.indices = (long *) bfd_malloc (amt);
  31717. +      if (finfo.indices == NULL)
  31718. +    goto error_return;
  31719. +
  31720. +      amt = max_sym_count * sizeof (asection *);
  31721. +      finfo.sections = (asection **) bfd_malloc (amt);
  31722. +      if (finfo.sections == NULL)
  31723. +    goto error_return;
  31724. +    }
  31725. +
  31726. +  if (max_sym_shndx_count != 0)
  31727. +    {
  31728. +      amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
  31729. +      finfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
  31730. +      if (finfo.locsym_shndx == NULL)
  31731. +    goto error_return;
  31732. +    }
  31733. +
  31734. +  if (finfo.first_tls_sec)
  31735. +    {
  31736. +      unsigned int align = 0;
  31737. +      bfd_vma base = finfo.first_tls_sec->vma, end = 0;
  31738. +      asection *sec;
  31739. +
  31740. +      for (sec = finfo.first_tls_sec;
  31741. +       sec && (sec->flags & SEC_THREAD_LOCAL);
  31742. +       sec = sec->next)
  31743. +    {
  31744. +      bfd_vma size = sec->_raw_size;
  31745. +
  31746. +      if (bfd_get_section_alignment (abfd, sec) > align)
  31747. +        align = bfd_get_section_alignment (abfd, sec);
  31748. +      if (sec->_raw_size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0)
  31749. +        {
  31750. +          struct bfd_link_order *o;
  31751. +
  31752. +          size = 0;
  31753. +          for (o = sec->link_order_head; o != NULL; o = o->next)
  31754. +        if (size < o->offset + o->size)
  31755. +          size = o->offset + o->size;
  31756. +        }
  31757. +      end = sec->vma + size;
  31758. +    }
  31759. +      elf_hash_table (info)->tls_segment
  31760. +    = bfd_zalloc (abfd, sizeof (struct elf_link_tls_segment));
  31761. +      if (elf_hash_table (info)->tls_segment == NULL)
  31762. +    goto error_return;
  31763. +      elf_hash_table (info)->tls_segment->start = base;
  31764. +      elf_hash_table (info)->tls_segment->size = end - base;
  31765. +      elf_hash_table (info)->tls_segment->align = align;
  31766. +    }
  31767. +
  31768. +  if (ddr_sec)
  31769. +    {
  31770. +      ddr_count = 0;
  31771. +      ddr_ptr = (unsigned *)bfd_alloc(abfd, 4 * max_datadata_reloc_count + 4);
  31772. +      if (ddr_ptr)
  31773. +    ++ddr_ptr;
  31774. +      else
  31775. +    goto error_return;
  31776. +    }
  31777. +  else
  31778. +    ddr_ptr = NULL;
  31779. +
  31780. +  /* Since ELF permits relocations to be against local symbols, we
  31781. +     must have the local symbols available when we do the relocations.
  31782. +     Since we would rather only read the local symbols once, and we
  31783. +     would rather not keep them in memory, we handle all the
  31784. +     relocations for a single input file at the same time.
  31785. +
  31786. +     Unfortunately, there is no way to know the total number of local
  31787. +     symbols until we have seen all of them, and the local symbol
  31788. +     indices precede the global symbol indices.  This means that when
  31789. +     we are generating relocateable output, and we see a reloc against
  31790. +     a global symbol, we can not know the symbol index until we have
  31791. +     finished examining all the local symbols to see which ones we are
  31792. +     going to output.  To deal with this, we keep the relocations in
  31793. +     memory, and don't output them until the end of the link.  This is
  31794. +     an unfortunate waste of memory, but I don't see a good way around
  31795. +     it.  Fortunately, it only happens when performing a relocateable
  31796. +     link, which is not the common case.  FIXME: If keep_memory is set
  31797. +     we could write the relocs out and then read them again; I don't
  31798. +     know how bad the memory loss will be.  */
  31799. +
  31800. +  for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
  31801. +    sub->output_has_begun = false;
  31802. +  for (o = abfd->sections; o != NULL; o = o->next)
  31803. +    {
  31804. +      for (p = o->link_order_head; p != NULL; p = p->next)
  31805. +    {
  31806. +      if (p->type == bfd_indirect_link_order
  31807. +          && (bfd_get_flavour ((sub = p->u.indirect.section->owner))
  31808. +          == bfd_target_elf_flavour)
  31809. +          && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass)
  31810. +        {
  31811. +          if (! sub->output_has_begun)
  31812. +        {
  31813. +          if (! elf_link_input_bfd (&finfo, sub))
  31814. +            goto error_return;
  31815. +          sub->output_has_begun = true;
  31816. +        }
  31817. +        }
  31818. +      else if (p->type == bfd_section_reloc_link_order
  31819. +           || p->type == bfd_symbol_reloc_link_order)
  31820. +        {
  31821. +          if (! elf_reloc_link_order (abfd, info, o, p))
  31822. +        goto error_return;
  31823. +        }
  31824. +      else
  31825. +        {
  31826. +          if (! _bfd_default_link_order (abfd, info, o, p))
  31827. +        goto error_return;
  31828. +        }
  31829. +    }
  31830. +    }
  31831. +
  31832. +  /* Output any global symbols that got converted to local in a
  31833. +     version script or due to symbol visibility.  We do this in a
  31834. +     separate step since ELF requires all local symbols to appear
  31835. +     prior to any global symbols.  FIXME: We should only do this if
  31836. +     some global symbols were, in fact, converted to become local.
  31837. +     FIXME: Will this work correctly with the Irix 5 linker?  */
  31838. +  eoinfo.failed = false;
  31839. +  eoinfo.finfo = &finfo;
  31840. +  eoinfo.localsyms = true;
  31841. +  elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
  31842. +              (PTR) &eoinfo);
  31843. +  if (eoinfo.failed)
  31844. +    return false;
  31845. +
  31846. +  /* Set the vma of the sections to 0. We can't do that before, otherwise the
  31847. +     relocation doesn't work properly for .sbss. */
  31848. +  {
  31849. +    int n = elf_elfheader(abfd)->e_shnum;
  31850. +    Elf_Internal_Shdr **hdr = elf_elfsections(abfd);
  31851. +    for (i = 1; i < n; ++i, ++hdr)
  31852. +      (*hdr)->sh_addr = 0;
  31853. +  }
  31854. +  
  31855. +  /* That wrote out all the local symbols.  Finish up the symbol table
  31856. +     with the global symbols. Even if we want to strip everything we
  31857. +     can, we still need to deal with those global symbols that got
  31858. +     converted to local in a version script.  */
  31859. +
  31860. +  /* The sh_info field records the index of the first non local symbol.  */
  31861. +  symtab_hdr->sh_info = bfd_get_symcount (abfd);
  31862. +
  31863. +  if (dynamic
  31864. +      && finfo.dynsym_sec->output_section != bfd_abs_section_ptr)
  31865. +    {
  31866. +      Elf_Internal_Sym sym;
  31867. +      Elf_External_Sym *dynsym =
  31868. +    (Elf_External_Sym *) finfo.dynsym_sec->contents;
  31869. +      long last_local = 0;
  31870. +
  31871. +      /* Write out the section symbols for the output sections.  */
  31872. +      if (info->shared)
  31873. +    {
  31874. +      asection *s;
  31875. +
  31876. +      sym.st_size = 0;
  31877. +      sym.st_name = 0;
  31878. +      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
  31879. +      sym.st_other = 0;
  31880. +
  31881. +      for (s = abfd->sections; s != NULL; s = s->next)
  31882. +        {
  31883. +          int indx;
  31884. +          Elf_External_Sym *dest;
  31885. +
  31886. +          indx = elf_section_data (s)->this_idx;
  31887. +          BFD_ASSERT (indx > 0);
  31888. +          sym.st_shndx = indx;
  31889. +          sym.st_value = s->vma;
  31890. +          dest = dynsym + elf_section_data (s)->dynindx;
  31891. +          elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
  31892. +        }
  31893. +
  31894. +      last_local = bfd_count_sections (abfd);
  31895. +    }
  31896. +
  31897. +      /* Write out the local dynsyms.  */
  31898. +      if (elf_hash_table (info)->dynlocal)
  31899. +    {
  31900. +      struct elf_link_local_dynamic_entry *e;
  31901. +      for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
  31902. +        {
  31903. +          asection *s;
  31904. +          Elf_External_Sym *dest;
  31905. +
  31906. +          sym.st_size = e->isym.st_size;
  31907. +          sym.st_other = e->isym.st_other;
  31908. +
  31909. +          /* Copy the internal symbol as is.
  31910. +         Note that we saved a word of storage and overwrote
  31911. +         the original st_name with the dynstr_index.  */
  31912. +          sym = e->isym;
  31913. +
  31914. +          if (e->isym.st_shndx != SHN_UNDEF
  31915. +          && (e->isym.st_shndx < SHN_LORESERVE
  31916. +              || e->isym.st_shndx > SHN_HIRESERVE))
  31917. +        {
  31918. +          s = bfd_section_from_elf_index (e->input_bfd,
  31919. +                          e->isym.st_shndx);
  31920. +
  31921. +          sym.st_shndx =
  31922. +            elf_section_data (s->output_section)->this_idx;
  31923. +          sym.st_value = (s->output_section->vma
  31924. +                  + s->output_offset
  31925. +                  + e->isym.st_value);
  31926. +        }
  31927. +
  31928. +          if (last_local < e->dynindx)
  31929. +        last_local = e->dynindx;
  31930. +
  31931. +          dest = dynsym + e->dynindx;
  31932. +          elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
  31933. +        }
  31934. +    }
  31935. +
  31936. +      elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info =
  31937. +    last_local + 1;
  31938. +    }
  31939. +
  31940. +  /* We get the global symbols from the hash table.  */
  31941. +  eoinfo.failed = false;
  31942. +  eoinfo.localsyms = false;
  31943. +  eoinfo.finfo = &finfo;
  31944. +  elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
  31945. +              (PTR) &eoinfo);
  31946. +  if (eoinfo.failed)
  31947. +    return false;
  31948. +
  31949. +  /* If backend needs to output some symbols not present in the hash
  31950. +     table, do it now.  */
  31951. +  if (bed->elf_backend_output_arch_syms)
  31952. +    {
  31953. +      typedef boolean (*out_sym_func) PARAMS ((PTR, const char *,
  31954. +                           Elf_Internal_Sym *,
  31955. +                           asection *));
  31956. +
  31957. +      if (! ((*bed->elf_backend_output_arch_syms)
  31958. +         (abfd, info, (PTR) &finfo, (out_sym_func) elf_link_output_sym)))
  31959. +    return false;
  31960. +    }
  31961. +
  31962. +  /* Flush all symbols to the file.  */
  31963. +  if (! elf_link_flush_output_syms (&finfo))
  31964. +    return false;
  31965. +
  31966. +  /* Now we know the size of the symtab section.  */
  31967. +  off += symtab_hdr->sh_size;
  31968. +
  31969. +  /* Add the __datadata_relocs table. */
  31970. +  if (ddr_sec)
  31971. +    {
  31972. +      Elf_Internal_Shdr *hdr = elf_elfsections(abfd)[_bfd_elf_section_from_bfd_section(abfd, ddr_sec)];
  31973. +      ddr_sec->_cooked_size = ddr_sec->_raw_size = hdr->sh_size = 4 * ddr_count + 4;
  31974. +      hdr->sh_addralign = 2;
  31975. +      off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
  31976. +      ddr_ptr -= ddr_count + 1;
  31977. +      *ddr_ptr = ddr_count ? ddr_count : -1;
  31978. +      bfd_set_section_contents(abfd, ddr_sec, ddr_ptr, 0, hdr->sh_size);
  31979. +    }
  31980. +  
  31981. +  /* Finish up and write out the symbol string table (.strtab)
  31982. +     section.  */
  31983. +  symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
  31984. +  /* sh_name was set in prep_headers.  */
  31985. +  symstrtab_hdr->sh_type = SHT_STRTAB;
  31986. +  symstrtab_hdr->sh_flags = 0;
  31987. +  symstrtab_hdr->sh_addr = 0;
  31988. +  symstrtab_hdr->sh_size = _bfd_stringtab_size (finfo.symstrtab);
  31989. +  symstrtab_hdr->sh_entsize = 0;
  31990. +  symstrtab_hdr->sh_link = 0;
  31991. +  symstrtab_hdr->sh_info = 0;
  31992. +  /* sh_offset is set just below.  */
  31993. +  symstrtab_hdr->sh_addralign = 1;
  31994. +
  31995. +  off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, true);
  31996. +  elf_tdata (abfd)->next_file_pos = off;
  31997. +
  31998. +  if (bfd_get_symcount (abfd) > 0)
  31999. +    {
  32000. +      if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
  32001. +      || ! _bfd_stringtab_emit (abfd, finfo.symstrtab))
  32002. +    return false;
  32003. +    }
  32004. +
  32005. +  /* Adjust the relocs to have the correct symbol indices.  */
  32006. +  for (o = abfd->sections; o != NULL; o = o->next)
  32007. +    {
  32008. +      if ((o->flags & SEC_RELOC) == 0)
  32009. +    continue;
  32010. +
  32011. +      elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr,
  32012. +                  elf_section_data (o)->rel_count,
  32013. +                  elf_section_data (o)->rel_hashes);
  32014. +      if (elf_section_data (o)->rel_hdr2 != NULL)
  32015. +    elf_link_adjust_relocs (abfd, elf_section_data (o)->rel_hdr2,
  32016. +                elf_section_data (o)->rel_count2,
  32017. +                (elf_section_data (o)->rel_hashes
  32018. +                 + elf_section_data (o)->rel_count));
  32019. +
  32020. +      elf_section_data (o)->rel_hdr.sh_size =
  32021. +    o->reloc_count * elf_section_data (o)->rel_hdr.sh_entsize;
  32022. +      
  32023. +      /* Set the reloc_count field to 0 to prevent write_relocs from
  32024. +     trying to swap the relocs out itself.  */
  32025. +      o->reloc_count = 0;
  32026. +    }
  32027. +
  32028. +  _bfd_elf_assign_file_positions_for_relocs (abfd);
  32029. +
  32030. +  if (dynamic && info->combreloc && dynobj != NULL)
  32031. +    relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
  32032. +
  32033. +  /* If we are linking against a dynamic object, or generating a
  32034. +     shared library, finish up the dynamic linking information.  */
  32035. +  if (dynamic)
  32036. +    {
  32037. +      Elf_External_Dyn *dyncon, *dynconend;
  32038. +
  32039. +      /* Fix up .dynamic entries.  */
  32040. +      o = bfd_get_section_by_name (dynobj, ".dynamic");
  32041. +      BFD_ASSERT (o != NULL);
  32042. +
  32043. +      dyncon = (Elf_External_Dyn *) o->contents;
  32044. +      dynconend = (Elf_External_Dyn *) (o->contents + o->_raw_size);
  32045. +      for (; dyncon < dynconend; dyncon++)
  32046. +    {
  32047. +      Elf_Internal_Dyn dyn;
  32048. +      const char *name;
  32049. +      unsigned int type;
  32050. +
  32051. +      elf_swap_dyn_in (dynobj, dyncon, &dyn);
  32052. +
  32053. +      switch (dyn.d_tag)
  32054. +        {
  32055. +        default:
  32056. +          break;
  32057. +        case DT_NULL:
  32058. +          if (relativecount > 0 && dyncon + 1 < dynconend)
  32059. +        {
  32060. +          switch (elf_section_data (reldyn)->this_hdr.sh_type)
  32061. +            {
  32062. +            case SHT_REL: dyn.d_tag = DT_RELCOUNT; break;
  32063. +            case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break;
  32064. +            default: break;
  32065. +            }
  32066. +          if (dyn.d_tag != DT_NULL)
  32067. +            {
  32068. +              dyn.d_un.d_val = relativecount;
  32069. +              elf_swap_dyn_out (dynobj, &dyn, dyncon);
  32070. +              relativecount = 0;
  32071. +            }
  32072. +        }
  32073. +          break;
  32074. +        case DT_INIT:
  32075. +          name = info->init_function;
  32076. +          goto get_sym;
  32077. +        case DT_FINI:
  32078. +          name = info->fini_function;
  32079. +        get_sym:
  32080. +          {
  32081. +        struct elf_link_hash_entry *h;
  32082. +
  32083. +        h = elf_link_hash_lookup (elf_hash_table (info), name,
  32084. +                      false, false, true);
  32085. +        if (h != NULL
  32086. +            && (h->root.type == bfd_link_hash_defined
  32087. +            || h->root.type == bfd_link_hash_defweak))
  32088. +          {
  32089. +            dyn.d_un.d_val = h->root.u.def.value;
  32090. +            o = h->root.u.def.section;
  32091. +            if (o->output_section != NULL)
  32092. +              dyn.d_un.d_val += (o->output_section->vma
  32093. +                     + o->output_offset);
  32094. +            else
  32095. +              {
  32096. +            /* The symbol is imported from another shared
  32097. +               library and does not apply to this one.  */
  32098. +            dyn.d_un.d_val = 0;
  32099. +              }
  32100. +
  32101. +            elf_swap_dyn_out (dynobj, &dyn, dyncon);
  32102. +          }
  32103. +          }
  32104. +          break;
  32105. +
  32106. +        case DT_PREINIT_ARRAYSZ:
  32107. +          name = ".preinit_array";
  32108. +          goto get_size;
  32109. +        case DT_INIT_ARRAYSZ:
  32110. +          name = ".init_array";
  32111. +          goto get_size;
  32112. +        case DT_FINI_ARRAYSZ:
  32113. +          name = ".fini_array";
  32114. +        get_size:
  32115. +          o = bfd_get_section_by_name (abfd, name);
  32116. +          if (o == NULL)
  32117. +        {
  32118. +          (*_bfd_error_handler)
  32119. +            (_("%s: could not find output section %s"),
  32120. +             bfd_get_filename (abfd), name);
  32121. +          goto error_return;
  32122. +        }
  32123. +          if (o->_raw_size == 0)
  32124. +        (*_bfd_error_handler)
  32125. +          (_("warning: %s section has zero size"), name);
  32126. +          dyn.d_un.d_val = o->_raw_size;
  32127. +          elf_swap_dyn_out (dynobj, &dyn, dyncon);
  32128. +          break;
  32129. +
  32130. +        case DT_PREINIT_ARRAY:
  32131. +          name = ".preinit_array";
  32132. +          goto get_vma;
  32133. +        case DT_INIT_ARRAY:
  32134. +          name = ".init_array";
  32135. +          goto get_vma;
  32136. +        case DT_FINI_ARRAY:
  32137. +          name = ".fini_array";
  32138. +          goto get_vma;
  32139. +
  32140. +        case DT_HASH:
  32141. +          name = ".hash";
  32142. +          goto get_vma;
  32143. +        case DT_STRTAB:
  32144. +          name = ".dynstr";
  32145. +          goto get_vma;
  32146. +        case DT_SYMTAB:
  32147. +          name = ".dynsym";
  32148. +          goto get_vma;
  32149. +        case DT_VERDEF:
  32150. +          name = ".gnu.version_d";
  32151. +          goto get_vma;
  32152. +        case DT_VERNEED:
  32153. +          name = ".gnu.version_r";
  32154. +          goto get_vma;
  32155. +        case DT_VERSYM:
  32156. +          name = ".gnu.version";
  32157. +        get_vma:
  32158. +          o = bfd_get_section_by_name (abfd, name);
  32159. +          if (o == NULL)
  32160. +        {
  32161. +          (*_bfd_error_handler)
  32162. +            (_("%s: could not find output section %s"),
  32163. +             bfd_get_filename (abfd), name);
  32164. +          goto error_return;
  32165. +        }
  32166. +          dyn.d_un.d_ptr = o->vma;
  32167. +          elf_swap_dyn_out (dynobj, &dyn, dyncon);
  32168. +          break;
  32169. +
  32170. +        case DT_REL:
  32171. +        case DT_RELA:
  32172. +        case DT_RELSZ:
  32173. +        case DT_RELASZ:
  32174. +          if (dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ)
  32175. +        type = SHT_REL;
  32176. +          else
  32177. +        type = SHT_RELA;
  32178. +          dyn.d_un.d_val = 0;
  32179. +          for (i = 1; i < elf_numsections (abfd); i++)
  32180. +        {
  32181. +          Elf_Internal_Shdr *hdr;
  32182. +
  32183. +          hdr = elf_elfsections (abfd)[i];
  32184. +          if (hdr->sh_type == type
  32185. +              && (hdr->sh_flags & SHF_ALLOC) != 0)
  32186. +            {
  32187. +              if (dyn.d_tag == DT_RELSZ || dyn.d_tag == DT_RELASZ)
  32188. +            dyn.d_un.d_val += hdr->sh_size;
  32189. +              else
  32190. +            {
  32191. +              if (dyn.d_un.d_val == 0
  32192. +                  || hdr->sh_addr < dyn.d_un.d_val)
  32193. +                dyn.d_un.d_val = hdr->sh_addr;
  32194. +            }
  32195. +            }
  32196. +        }
  32197. +          elf_swap_dyn_out (dynobj, &dyn, dyncon);
  32198. +          break;
  32199. +        }
  32200. +    }
  32201. +    }
  32202. +
  32203. +  /* If we have created any dynamic sections, then output them.  */
  32204. +  if (dynobj != NULL)
  32205. +    {
  32206. +      if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info))
  32207. +    goto error_return;
  32208. +
  32209. +      for (o = dynobj->sections; o != NULL; o = o->next)
  32210. +    {
  32211. +      if ((o->flags & SEC_HAS_CONTENTS) == 0
  32212. +          || o->_raw_size == 0
  32213. +          || o->output_section == bfd_abs_section_ptr)
  32214. +        continue;
  32215. +      if ((o->flags & SEC_LINKER_CREATED) == 0)
  32216. +        {
  32217. +          /* At this point, we are only interested in sections
  32218. +         created by elf_link_create_dynamic_sections.  */
  32219. +          continue;
  32220. +        }
  32221. +      if ((elf_section_data (o->output_section)->this_hdr.sh_type
  32222. +           != SHT_STRTAB)
  32223. +          || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
  32224. +        {
  32225. +          if (! bfd_set_section_contents (abfd, o->output_section,
  32226. +                          o->contents,
  32227. +                          (file_ptr) o->output_offset,
  32228. +                          o->_raw_size))
  32229. +        goto error_return;
  32230. +        }
  32231. +      else
  32232. +        {
  32233. +          /* The contents of the .dynstr section are actually in a
  32234. +         stringtab.  */
  32235. +          off = elf_section_data (o->output_section)->this_hdr.sh_offset;
  32236. +          if (bfd_seek (abfd, off, SEEK_SET) != 0
  32237. +          || ! _bfd_elf_strtab_emit (abfd,
  32238. +                         elf_hash_table (info)->dynstr))
  32239. +        goto error_return;
  32240. +        }
  32241. +    }
  32242. +    }
  32243. +
  32244. +  if (info->relocateable)
  32245. +    {
  32246. +      boolean failed = false;
  32247. +
  32248. +      bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
  32249. +      if (failed)
  32250. +    goto error_return;
  32251. +    }
  32252. +
  32253. +  /* If we have optimized stabs strings, output them.  */
  32254. +  if (elf_hash_table (info)->stab_info != NULL)
  32255. +    {
  32256. +      if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info))
  32257. +    goto error_return;
  32258. +    }
  32259. +
  32260. +  if (info->eh_frame_hdr && elf_hash_table (info)->dynobj)
  32261. +    {
  32262. +      o = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
  32263. +                   ".eh_frame_hdr");
  32264. +      if (o
  32265. +      && (elf_section_data (o)->sec_info_type
  32266. +          == ELF_INFO_TYPE_EH_FRAME_HDR))
  32267. +    {
  32268. +      if (! _bfd_elf_write_section_eh_frame_hdr (abfd, o))
  32269. +        goto error_return;
  32270. +    }
  32271. +    }
  32272. +
  32273. +  if (finfo.symstrtab != NULL)
  32274. +    _bfd_stringtab_free (finfo.symstrtab);
  32275. +  if (finfo.contents != NULL)
  32276. +    free (finfo.contents);
  32277. +  if (finfo.external_relocs != NULL)
  32278. +    free (finfo.external_relocs);
  32279. +  if (finfo.internal_relocs != NULL)
  32280. +    free (finfo.internal_relocs);
  32281. +  if (finfo.external_syms != NULL)
  32282. +    free (finfo.external_syms);
  32283. +  if (finfo.locsym_shndx != NULL)
  32284. +    free (finfo.locsym_shndx);
  32285. +  if (finfo.internal_syms != NULL)
  32286. +    free (finfo.internal_syms);
  32287. +  if (finfo.indices != NULL)
  32288. +    free (finfo.indices);
  32289. +  if (finfo.sections != NULL)
  32290. +    free (finfo.sections);
  32291. +  if (finfo.symbuf != NULL)
  32292. +    free (finfo.symbuf);
  32293. +  if (finfo.symshndxbuf != NULL)
  32294. +    free (finfo.symbuf);
  32295. +  for (o = abfd->sections; o != NULL; o = o->next)
  32296. +    {
  32297. +      if ((o->flags & SEC_RELOC) != 0
  32298. +      && elf_section_data (o)->rel_hashes != NULL)
  32299. +    free (elf_section_data (o)->rel_hashes);
  32300. +    }
  32301. +
  32302. +  elf_tdata (abfd)->linker = true;
  32303. +
  32304. +  return true;
  32305. +
  32306. + error_return:
  32307. +  if (finfo.symstrtab != NULL)
  32308. +    _bfd_stringtab_free (finfo.symstrtab);
  32309. +  if (finfo.contents != NULL)
  32310. +    free (finfo.contents);
  32311. +  if (finfo.external_relocs != NULL)
  32312. +    free (finfo.external_relocs);
  32313. +  if (finfo.internal_relocs != NULL)
  32314. +    free (finfo.internal_relocs);
  32315. +  if (finfo.external_syms != NULL)
  32316. +    free (finfo.external_syms);
  32317. +  if (finfo.locsym_shndx != NULL)
  32318. +    free (finfo.locsym_shndx);
  32319. +  if (finfo.internal_syms != NULL)
  32320. +    free (finfo.internal_syms);
  32321. +  if (finfo.indices != NULL)
  32322. +    free (finfo.indices);
  32323. +  if (finfo.sections != NULL)
  32324. +    free (finfo.sections);
  32325. +  if (finfo.symbuf != NULL)
  32326. +    free (finfo.symbuf);
  32327. +  if (finfo.symshndxbuf != NULL)
  32328. +    free (finfo.symbuf);
  32329. +  for (o = abfd->sections; o != NULL; o = o->next)
  32330. +    {
  32331. +      if ((o->flags & SEC_RELOC) != 0
  32332. +      && elf_section_data (o)->rel_hashes != NULL)
  32333. +    free (elf_section_data (o)->rel_hashes);
  32334. +    }
  32335. +
  32336. +  return false;
  32337. +}
  32338. +
  32339. +/* Add a symbol to the output symbol table.  */
  32340. +
  32341. +static boolean
  32342. +elf_link_output_sym (finfo, name, elfsym, input_sec)
  32343. +     struct elf_final_link_info *finfo;
  32344. +     const char *name;
  32345. +     Elf_Internal_Sym *elfsym;
  32346. +     asection *input_sec;
  32347. +{
  32348. +  Elf_External_Sym *dest;
  32349. +  Elf_External_Sym_Shndx *destshndx;
  32350. +
  32351. +  boolean (*output_symbol_hook) PARAMS ((bfd *,
  32352. +                     struct bfd_link_info *info,
  32353. +                     const char *,
  32354. +                     Elf_Internal_Sym *,
  32355. +                     asection *));
  32356. +
  32357. +  output_symbol_hook = get_elf_backend_data (finfo->output_bfd)->
  32358. +    elf_backend_link_output_symbol_hook;
  32359. +  if (output_symbol_hook != NULL)
  32360. +    {
  32361. +      if (! ((*output_symbol_hook)
  32362. +         (finfo->output_bfd, finfo->info, name, elfsym, input_sec)))
  32363. +    return false;
  32364. +    }
  32365. +
  32366. +  if (name == (const char *) NULL || *name == '\0')
  32367. +    elfsym->st_name = 0;
  32368. +  else if (input_sec->flags & SEC_EXCLUDE)
  32369. +    elfsym->st_name = 0;
  32370. +  else
  32371. +    {
  32372. +      elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
  32373. +                                name, true, false);
  32374. +      if (elfsym->st_name == (unsigned long) -1)
  32375. +    return false;
  32376. +    }
  32377. +
  32378. +  if (finfo->symbuf_count >= finfo->symbuf_size)
  32379. +    {
  32380. +      if (! elf_link_flush_output_syms (finfo))
  32381. +    return false;
  32382. +    }
  32383. +
  32384. +  dest = finfo->symbuf + finfo->symbuf_count;
  32385. +  destshndx = finfo->symshndxbuf;
  32386. +  if (destshndx != NULL)
  32387. +    destshndx += finfo->symbuf_count;
  32388. +  elf_swap_symbol_out (finfo->output_bfd, elfsym, (PTR) dest, (PTR) destshndx);
  32389. +  ++finfo->symbuf_count;
  32390. +
  32391. +  ++ bfd_get_symcount (finfo->output_bfd);
  32392. +
  32393. +  return true;
  32394. +}
  32395. +
  32396. +/* Flush the output symbols to the file.  */
  32397. +
  32398. +static boolean
  32399. +elf_link_flush_output_syms (finfo)
  32400. +     struct elf_final_link_info *finfo;
  32401. +{
  32402. +  if (finfo->symbuf_count > 0)
  32403. +    {
  32404. +      Elf_Internal_Shdr *hdr;
  32405. +      file_ptr pos;
  32406. +      bfd_size_type amt;
  32407. +
  32408. +      hdr = &elf_tdata (finfo->output_bfd)->symtab_hdr;
  32409. +      pos = hdr->sh_offset + hdr->sh_size;
  32410. +      amt = finfo->symbuf_count * sizeof (Elf_External_Sym);
  32411. +      if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
  32412. +      || bfd_bwrite ((PTR) finfo->symbuf, amt, finfo->output_bfd) != amt)
  32413. +    return false;
  32414. +
  32415. +      hdr->sh_size += amt;
  32416. +
  32417. +      if (finfo->symshndxbuf != NULL)
  32418. +    {
  32419. +      hdr = &elf_tdata (finfo->output_bfd)->symtab_shndx_hdr;
  32420. +      pos = hdr->sh_offset + hdr->sh_size;
  32421. +      amt = finfo->symbuf_count * sizeof (Elf_External_Sym_Shndx);
  32422. +      if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
  32423. +          || (bfd_bwrite ((PTR) finfo->symshndxbuf, amt, finfo->output_bfd)
  32424. +          != amt))
  32425. +        return false;
  32426. +
  32427. +      hdr->sh_size += amt;
  32428. +    }
  32429. +
  32430. +      finfo->symbuf_count = 0;
  32431. +    }
  32432. +
  32433. +  return true;
  32434. +}
  32435. +
  32436. +/* Adjust all external symbols pointing into SEC_MERGE sections
  32437. +   to reflect the object merging within the sections.  */
  32438. +
  32439. +static boolean
  32440. +elf_link_sec_merge_syms (h, data)
  32441. +     struct elf_link_hash_entry *h;
  32442. +     PTR data;
  32443. +{
  32444. +  asection *sec;
  32445. +
  32446. +  if (h->root.type == bfd_link_hash_warning)
  32447. +    h = (struct elf_link_hash_entry *) h->root.u.i.link;
  32448. +
  32449. +  if ((h->root.type == bfd_link_hash_defined
  32450. +       || h->root.type == bfd_link_hash_defweak)
  32451. +      && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
  32452. +      && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
  32453. +    {
  32454. +      bfd *output_bfd = (bfd *) data;
  32455. +
  32456. +      h->root.u.def.value =
  32457. +    _bfd_merged_section_offset (output_bfd,
  32458. +                    &h->root.u.def.section,
  32459. +                    elf_section_data (sec)->sec_info,
  32460. +                    h->root.u.def.value, (bfd_vma) 0);
  32461. +    }
  32462. +
  32463. +  return true;
  32464. +}
  32465. +
  32466. +/* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in
  32467. +   allowing an unsatisfied unversioned symbol in the DSO to match a
  32468. +   versioned symbol that would normally require an explicit version.  */
  32469. +
  32470. +static boolean
  32471. +elf_link_check_versioned_symbol (info, h)
  32472. +     struct bfd_link_info *info;
  32473. +     struct elf_link_hash_entry *h;
  32474. +{
  32475. +  bfd *undef_bfd = h->root.u.undef.abfd;
  32476. +  struct elf_link_loaded_list *loaded;
  32477. +
  32478. +  if ((undef_bfd->flags & DYNAMIC) == 0
  32479. +      || info->hash->creator->flavour != bfd_target_elf_flavour
  32480. +      || elf_dt_soname (h->root.u.undef.abfd) == NULL)
  32481. +    return false;
  32482. +
  32483. +  for (loaded = elf_hash_table (info)->loaded;
  32484. +       loaded != NULL;
  32485. +       loaded = loaded->next)
  32486. +    {
  32487. +      bfd *input;
  32488. +      Elf_Internal_Shdr *hdr;
  32489. +      bfd_size_type symcount;
  32490. +      bfd_size_type extsymcount;
  32491. +      bfd_size_type extsymoff;
  32492. +      Elf_Internal_Shdr *versymhdr;
  32493. +      Elf_Internal_Sym *isym;
  32494. +      Elf_Internal_Sym *isymend;
  32495. +      Elf_Internal_Sym *isymbuf;
  32496. +      Elf_External_Versym *ever;
  32497. +      Elf_External_Versym *extversym;
  32498. +
  32499. +      input = loaded->abfd;
  32500. +
  32501. +      /* We check each DSO for a possible hidden versioned definition.  */
  32502. +      if (input == undef_bfd
  32503. +      || (input->flags & DYNAMIC) == 0
  32504. +      || elf_dynversym (input) == 0)
  32505. +    continue;
  32506. +
  32507. +      hdr = &elf_tdata (input)->dynsymtab_hdr;
  32508. +
  32509. +      symcount = hdr->sh_size / sizeof (Elf_External_Sym);
  32510. +      if (elf_bad_symtab (input))
  32511. +    {
  32512. +      extsymcount = symcount;
  32513. +      extsymoff = 0;
  32514. +    }
  32515. +      else
  32516. +    {
  32517. +      extsymcount = symcount - hdr->sh_info;
  32518. +      extsymoff = hdr->sh_info;
  32519. +    }
  32520. +
  32521. +      if (extsymcount == 0)
  32522. +    continue;
  32523. +
  32524. +      isymbuf = bfd_elf_get_elf_syms (input, hdr, extsymcount, extsymoff,
  32525. +                      NULL, NULL, NULL);
  32526. +      if (isymbuf == NULL)
  32527. +    return false;
  32528. +
  32529. +      /* Read in any version definitions.  */
  32530. +      versymhdr = &elf_tdata (input)->dynversym_hdr;
  32531. +      extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
  32532. +      if (extversym == NULL)
  32533. +    goto error_ret;
  32534. +
  32535. +      if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0
  32536. +      || (bfd_bread ((PTR) extversym, versymhdr->sh_size, input)
  32537. +          != versymhdr->sh_size))
  32538. +    {
  32539. +      free (extversym);
  32540. +    error_ret:
  32541. +      free (isymbuf);
  32542. +      return false;
  32543. +    }
  32544. +
  32545. +      ever = extversym + extsymoff;
  32546. +      isymend = isymbuf + extsymcount;
  32547. +      for (isym = isymbuf; isym < isymend; isym++, ever++)
  32548. +    {
  32549. +      const char *name;
  32550. +      Elf_Internal_Versym iver;
  32551. +
  32552. +      if (ELF_ST_BIND (isym->st_info) == STB_LOCAL
  32553. +          || isym->st_shndx == SHN_UNDEF)
  32554. +        continue;
  32555. +
  32556. +      name = bfd_elf_string_from_elf_section (input,
  32557. +                          hdr->sh_link,
  32558. +                          isym->st_name);
  32559. +      if (strcmp (name, h->root.root.string) != 0)
  32560. +        continue;
  32561. +
  32562. +      _bfd_elf_swap_versym_in (input, ever, &iver);
  32563. +
  32564. +      if ((iver.vs_vers & VERSYM_HIDDEN) == 0)
  32565. +        {
  32566. +          /* If we have a non-hidden versioned sym, then it should
  32567. +         have provided a definition for the undefined sym.  */
  32568. +          abort ();
  32569. +        }
  32570. +
  32571. +      if ((iver.vs_vers & VERSYM_VERSION) == 2)
  32572. +        {
  32573. +          /* This is the oldest (default) sym.  We can use it.  */
  32574. +          free (extversym);
  32575. +          free (isymbuf);
  32576. +          return true;
  32577. +        }
  32578. +    }
  32579. +
  32580. +      free (extversym);
  32581. +      free (isymbuf);
  32582. +    }
  32583. +
  32584. +  return false;
  32585. +}
  32586. +
  32587. +/* Add an external symbol to the symbol table.  This is called from
  32588. +   the hash table traversal routine.  When generating a shared object,
  32589. +   we go through the symbol table twice.  The first time we output
  32590. +   anything that might have been forced to local scope in a version
  32591. +   script.  The second time we output the symbols that are still
  32592. +   global symbols.  */
  32593. +
  32594. +static boolean
  32595. +elf_link_output_extsym (h, data)
  32596. +     struct elf_link_hash_entry *h;
  32597. +     PTR data;
  32598. +{
  32599. +  struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
  32600. +  struct elf_final_link_info *finfo = eoinfo->finfo;
  32601. +  boolean strip;
  32602. +  Elf_Internal_Sym sym;
  32603. +  asection *input_sec;
  32604. +
  32605. +  if (h->root.type == bfd_link_hash_warning)
  32606. +    {
  32607. +      h = (struct elf_link_hash_entry *) h->root.u.i.link;
  32608. +      if (h->root.type == bfd_link_hash_new)
  32609. +    return true;
  32610. +    }
  32611. +
  32612. +  /* Decide whether to output this symbol in this pass.  */
  32613. +  if (eoinfo->localsyms)
  32614. +    {
  32615. +      if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
  32616. +    return true;
  32617. +    }
  32618. +  else
  32619. +    {
  32620. +      if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
  32621. +    return true;
  32622. +    }
  32623. +
  32624. +  /* If we are not creating a shared library, and this symbol is
  32625. +     referenced by a shared library but is not defined anywhere, then
  32626. +     warn that it is undefined.  If we do not do this, the runtime
  32627. +     linker will complain that the symbol is undefined when the
  32628. +     program is run.  We don't have to worry about symbols that are
  32629. +     referenced by regular files, because we will already have issued
  32630. +     warnings for them.  */
  32631. +  if (! finfo->info->relocateable
  32632. +      && ! finfo->info->allow_shlib_undefined
  32633. +      && ! finfo->info->shared
  32634. +      && h->root.type == bfd_link_hash_undefined
  32635. +      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
  32636. +      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
  32637. +      && ! elf_link_check_versioned_symbol (finfo->info, h))
  32638. +    {
  32639. +      if (! ((*finfo->info->callbacks->undefined_symbol)
  32640. +         (finfo->info, h->root.root.string, h->root.u.undef.abfd,
  32641. +          (asection *) NULL, (bfd_vma) 0, true)))
  32642. +    {
  32643. +      eoinfo->failed = true;
  32644. +      return false;
  32645. +    }
  32646. +    }
  32647. +
  32648. +  /* We don't want to output symbols that have never been mentioned by
  32649. +     a regular file, or that we have been told to strip.  However, if
  32650. +     h->indx is set to -2, the symbol is used by a reloc and we must
  32651. +     output it.  */
  32652. +  if (h->indx == -2)
  32653. +    strip = false;
  32654. +  else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
  32655. +        || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
  32656. +       && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
  32657. +       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
  32658. +    strip = true;
  32659. +  else if (finfo->info->strip == strip_all
  32660. +       || (finfo->info->strip == strip_some
  32661. +           && bfd_hash_lookup (finfo->info->keep_hash,
  32662. +                   h->root.root.string,
  32663. +                   false, false) == NULL))
  32664. +    strip = true;
  32665. +  else
  32666. +    strip = false;
  32667. +
  32668. +  /* If we're stripping it, and it's not a dynamic symbol, there's
  32669. +     nothing else to do unless it is a forced local symbol.  */
  32670. +  if (strip
  32671. +      && h->dynindx == -1
  32672. +      && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
  32673. +    return true;
  32674. +
  32675. +  sym.st_value = 0;
  32676. +  sym.st_size = h->size;
  32677. +  sym.st_other = h->other;
  32678. +  if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
  32679. +    sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type);
  32680. +  else if (h->root.type == bfd_link_hash_undefweak
  32681. +       || h->root.type == bfd_link_hash_defweak)
  32682. +    sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
  32683. +  else
  32684. +    sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type);
  32685. +
  32686. +  switch (h->root.type)
  32687. +    {
  32688. +    default:
  32689. +    case bfd_link_hash_new:
  32690. +    case bfd_link_hash_warning:
  32691. +      abort ();
  32692. +      return false;
  32693. +
  32694. +    case bfd_link_hash_undefined:
  32695. +    case bfd_link_hash_undefweak:
  32696. +      input_sec = bfd_und_section_ptr;
  32697. +      sym.st_shndx = SHN_UNDEF;
  32698. +      break;
  32699. +
  32700. +    case bfd_link_hash_defined:
  32701. +    case bfd_link_hash_defweak:
  32702. +      {
  32703. +    input_sec = h->root.u.def.section;
  32704. +    if (input_sec->output_section != NULL)
  32705. +      {
  32706. +        sym.st_shndx =
  32707. +          _bfd_elf_section_from_bfd_section (finfo->output_bfd,
  32708. +                         input_sec->output_section);
  32709. +        if (sym.st_shndx == SHN_BAD)
  32710. +          {
  32711. +        (*_bfd_error_handler)
  32712. +          (_("%s: could not find output section %s for input section %s"),
  32713. +           bfd_get_filename (finfo->output_bfd),
  32714. +           input_sec->output_section->name,
  32715. +           input_sec->name);
  32716. +        eoinfo->failed = true;
  32717. +        return false;
  32718. +          }
  32719. +
  32720. +        /* ELF symbols in relocateable files are section relative,
  32721. +           but in nonrelocateable files they are virtual
  32722. +           addresses.  */
  32723. +        sym.st_value = h->root.u.def.value + input_sec->output_offset;
  32724. +#if 0
  32725. +        if (! finfo->info->relocateable)
  32726. +          {
  32727. +        sym.st_value += input_sec->output_section->vma;
  32728. +        if (h->type == STT_TLS)
  32729. +          {
  32730. +            /* STT_TLS symbols are relative to PT_TLS segment
  32731. +               base.  */
  32732. +            BFD_ASSERT (finfo->first_tls_sec != NULL);
  32733. +            sym.st_value -= finfo->first_tls_sec->vma;
  32734. +          }
  32735. +          }
  32736. +#endif
  32737. +      }
  32738. +    else
  32739. +      {
  32740. +        BFD_ASSERT (input_sec->owner == NULL
  32741. +            || (input_sec->owner->flags & DYNAMIC) != 0);
  32742. +        sym.st_shndx = SHN_UNDEF;
  32743. +        input_sec = bfd_und_section_ptr;
  32744. +      }
  32745. +      }
  32746. +      break;
  32747. +
  32748. +    case bfd_link_hash_common:
  32749. +      input_sec = h->root.u.c.p->section;
  32750. +      sym.st_shndx = SHN_COMMON;
  32751. +      sym.st_value = 1 << h->root.u.c.p->alignment_power;
  32752. +      break;
  32753. +
  32754. +    case bfd_link_hash_indirect:
  32755. +      /* These symbols are created by symbol versioning.  They point
  32756. +     to the decorated version of the name.  For example, if the
  32757. +     symbol foo@@GNU_1.2 is the default, which should be used when
  32758. +     foo is used with no version, then we add an indirect symbol
  32759. +     foo which points to foo@@GNU_1.2.  We ignore these symbols,
  32760. +     since the indirected symbol is already in the hash table.  */
  32761. +      return true;
  32762. +    }
  32763. +
  32764. +  /* Give the processor backend a chance to tweak the symbol value,
  32765. +     and also to finish up anything that needs to be done for this
  32766. +     symbol.  FIXME: Not calling elf_backend_finish_dynamic_symbol for
  32767. +     forced local syms when non-shared is due to a historical quirk.  */
  32768. +  if ((h->dynindx != -1
  32769. +       || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
  32770. +      && (finfo->info->shared
  32771. +      || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
  32772. +      && elf_hash_table (finfo->info)->dynamic_sections_created)
  32773. +    {
  32774. +      struct elf_backend_data *bed;
  32775. +
  32776. +      bed = get_elf_backend_data (finfo->output_bfd);
  32777. +      if (! ((*bed->elf_backend_finish_dynamic_symbol)
  32778. +         (finfo->output_bfd, finfo->info, h, &sym)))
  32779. +    {
  32780. +      eoinfo->failed = true;
  32781. +      return false;
  32782. +    }
  32783. +    }
  32784. +
  32785. +  /* If we are marking the symbol as undefined, and there are no
  32786. +     non-weak references to this symbol from a regular object, then
  32787. +     mark the symbol as weak undefined; if there are non-weak
  32788. +     references, mark the symbol as strong.  We can't do this earlier,
  32789. +     because it might not be marked as undefined until the
  32790. +     finish_dynamic_symbol routine gets through with it.  */
  32791. +  if (sym.st_shndx == SHN_UNDEF
  32792. +      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
  32793. +      && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL
  32794. +      || ELF_ST_BIND (sym.st_info) == STB_WEAK))
  32795. +    {
  32796. +      int bindtype;
  32797. +
  32798. +      if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0)
  32799. +    bindtype = STB_GLOBAL;
  32800. +      else
  32801. +    bindtype = STB_WEAK;
  32802. +      sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
  32803. +    }
  32804. +
  32805. +  /* If a symbol is not defined locally, we clear the visibility
  32806. +     field.  */
  32807. +  if (! finfo->info->relocateable
  32808. +      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
  32809. +    sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other);
  32810. +
  32811. +  /* If this symbol should be put in the .dynsym section, then put it
  32812. +     there now.  We already know the symbol index.  We also fill in
  32813. +     the entry in the .hash section.  */
  32814. +  if (h->dynindx != -1
  32815. +      && elf_hash_table (finfo->info)->dynamic_sections_created)
  32816. +    {
  32817. +      size_t bucketcount;
  32818. +      size_t bucket;
  32819. +      size_t hash_entry_size;
  32820. +      bfd_byte *bucketpos;
  32821. +      bfd_vma chain;
  32822. +      Elf_External_Sym *esym;
  32823. +
  32824. +      sym.st_name = h->dynstr_index;
  32825. +      esym = (Elf_External_Sym *) finfo->dynsym_sec->contents + h->dynindx;
  32826. +      elf_swap_symbol_out (finfo->output_bfd, &sym, (PTR) esym, (PTR) 0);
  32827. +
  32828. +      bucketcount = elf_hash_table (finfo->info)->bucketcount;
  32829. +      bucket = h->elf_hash_value % bucketcount;
  32830. +      hash_entry_size
  32831. +    = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
  32832. +      bucketpos = ((bfd_byte *) finfo->hash_sec->contents
  32833. +           + (bucket + 2) * hash_entry_size);
  32834. +      chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
  32835. +      bfd_put (8 * hash_entry_size, finfo->output_bfd, (bfd_vma) h->dynindx,
  32836. +           bucketpos);
  32837. +      bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
  32838. +           ((bfd_byte *) finfo->hash_sec->contents
  32839. +        + (bucketcount + 2 + h->dynindx) * hash_entry_size));
  32840. +
  32841. +      if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
  32842. +    {
  32843. +      Elf_Internal_Versym iversym;
  32844. +      Elf_External_Versym *eversym;
  32845. +
  32846. +      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
  32847. +        {
  32848. +          if (h->verinfo.verdef == NULL)
  32849. +        iversym.vs_vers = 0;
  32850. +          else
  32851. +        iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1;
  32852. +        }
  32853. +      else
  32854. +        {
  32855. +          if (h->verinfo.vertree == NULL)
  32856. +        iversym.vs_vers = 1;
  32857. +          else
  32858. +        iversym.vs_vers = h->verinfo.vertree->vernum + 1;
  32859. +        }
  32860. +
  32861. +      if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0)
  32862. +        iversym.vs_vers |= VERSYM_HIDDEN;
  32863. +
  32864. +      eversym = (Elf_External_Versym *) finfo->symver_sec->contents;
  32865. +      eversym += h->dynindx;
  32866. +      _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
  32867. +    }
  32868. +    }
  32869. +
  32870. +  /* If we're stripping it, then it was just a dynamic symbol, and
  32871. +     there's nothing else to do.  */
  32872. +  if (strip || (input_sec->flags & SEC_EXCLUDE) != 0)
  32873. +    return true;
  32874. +
  32875. +  h->indx = bfd_get_symcount (finfo->output_bfd);
  32876. +
  32877. +  if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec))
  32878. +    {
  32879. +      eoinfo->failed = true;
  32880. +      return false;
  32881. +    }
  32882. +
  32883. +  return true;
  32884. +}
  32885. +
  32886. +/* Copy the relocations indicated by the INTERNAL_RELOCS (which
  32887. +   originated from the section given by INPUT_REL_HDR) to the
  32888. +   OUTPUT_BFD.  */
  32889. +
  32890. +static boolean
  32891. +elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
  32892. +            internal_relocs)
  32893. +     bfd *output_bfd;
  32894. +     asection *input_section;
  32895. +     Elf_Internal_Shdr *input_rel_hdr;
  32896. +     Elf_Internal_Rela *internal_relocs;
  32897. +{
  32898. +  Elf_Internal_Rela *irela;
  32899. +  Elf_Internal_Rela *irelaend;
  32900. +  Elf_Internal_Shdr *output_rel_hdr;
  32901. +  asection *output_section;
  32902. +  unsigned int *rel_countp = NULL;
  32903. +  struct elf_backend_data *bed;
  32904. +  bfd_size_type amt;
  32905. +
  32906. +  output_section = input_section->output_section;
  32907. +  output_rel_hdr = NULL;
  32908. +
  32909. +  if (elf_section_data (output_section)->rel_hdr.sh_entsize
  32910. +      == input_rel_hdr->sh_entsize)
  32911. +    {
  32912. +      output_rel_hdr = &elf_section_data (output_section)->rel_hdr;
  32913. +      rel_countp = &elf_section_data (output_section)->rel_count;
  32914. +    }
  32915. +  else if (elf_section_data (output_section)->rel_hdr2
  32916. +       && (elf_section_data (output_section)->rel_hdr2->sh_entsize
  32917. +           == input_rel_hdr->sh_entsize))
  32918. +    {
  32919. +      output_rel_hdr = elf_section_data (output_section)->rel_hdr2;
  32920. +      rel_countp = &elf_section_data (output_section)->rel_count2;
  32921. +    }
  32922. +  else
  32923. +    {
  32924. +      (*_bfd_error_handler)
  32925. +    (_("%s: relocation size mismatch in %s section %s"),
  32926. +     bfd_get_filename (output_bfd),
  32927. +     bfd_archive_filename (input_section->owner),
  32928. +     input_section->name);
  32929. +      bfd_set_error (bfd_error_wrong_object_format);
  32930. +      return false;
  32931. +    }
  32932. +
  32933. +  bed = get_elf_backend_data (output_bfd);
  32934. +  irela = internal_relocs;
  32935. +  irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
  32936. +              * bed->s->int_rels_per_ext_rel);
  32937. +
  32938. +  if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
  32939. +    {
  32940. +      Elf_External_Rel *erel;
  32941. +      Elf_Internal_Rel *irel;
  32942. +
  32943. +      amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
  32944. +      irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
  32945. +      if (irel == NULL)
  32946. +    {
  32947. +      (*_bfd_error_handler) (_("Error: out of memory"));
  32948. +      abort ();
  32949. +    }
  32950. +
  32951. +      erel = ((Elf_External_Rel *) output_rel_hdr->contents + *rel_countp);
  32952. +      for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++)
  32953. +    {
  32954. +      unsigned int i;
  32955. +
  32956. +      for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
  32957. +        {
  32958. +          irel[i].r_offset = irela[i].r_offset;
  32959. +          irel[i].r_info = irela[i].r_info;
  32960. +          BFD_ASSERT (irela[i].r_addend == 0);
  32961. +        }
  32962. +
  32963. +      if (bed->s->swap_reloc_out)
  32964. +        (*bed->s->swap_reloc_out) (output_bfd, irel, (PTR) erel);
  32965. +      else
  32966. +        elf_swap_reloc_out (output_bfd, irel, erel);
  32967. +    }
  32968. +
  32969. +      free (irel);
  32970. +    }
  32971. +  else
  32972. +    {
  32973. +      Elf_External_Rela *erela;
  32974. +
  32975. +      BFD_ASSERT (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela));
  32976. +
  32977. +      erela = ((Elf_External_Rela *) output_rel_hdr->contents + *rel_countp);
  32978. +      for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erela++)
  32979. +    if (bed->s->swap_reloca_out)
  32980. +      (*bed->s->swap_reloca_out) (output_bfd, irela, (PTR) erela);
  32981. +    else
  32982. +      elf_swap_reloca_out (output_bfd, irela, erela);
  32983. +    }
  32984. +
  32985. +  /* Bump the counter, so that we know where to add the next set of
  32986. +     relocations.  */
  32987. +  *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr);
  32988. +
  32989. +  return true;
  32990. +}
  32991. +
  32992. +/* Link an input file into the linker output file.  This function
  32993. +   handles all the sections and relocations of the input file at once.
  32994. +   This is so that we only have to read the local symbols once, and
  32995. +   don't have to keep them in memory.  */
  32996. +
  32997. +static boolean
  32998. +elf_link_input_bfd (finfo, input_bfd)
  32999. +     struct elf_final_link_info *finfo;
  33000. +     bfd *input_bfd;
  33001. +{
  33002. +  boolean (*relocate_section) PARAMS ((bfd *, struct bfd_link_info *,
  33003. +                       bfd *, asection *, bfd_byte *,
  33004. +                       Elf_Internal_Rela *,
  33005. +                       Elf_Internal_Sym *, asection **));
  33006. +  bfd *output_bfd;
  33007. +  Elf_Internal_Shdr *symtab_hdr;
  33008. +  size_t locsymcount;
  33009. +  size_t extsymoff;
  33010. +  Elf_Internal_Sym *isymbuf;
  33011. +  Elf_Internal_Sym *isym;
  33012. +  Elf_Internal_Sym *isymend;
  33013. +  long *pindex;
  33014. +  asection **ppsection;
  33015. +  asection *o;
  33016. +  struct elf_backend_data *bed;
  33017. +  boolean emit_relocs;
  33018. +  struct elf_link_hash_entry **sym_hashes;
  33019. +
  33020. +  output_bfd = finfo->output_bfd;
  33021. +  bed = get_elf_backend_data (output_bfd);
  33022. +  relocate_section = bed->elf_backend_relocate_section;
  33023. +
  33024. +  /* If this is a dynamic object, we don't want to do anything here:
  33025. +     we don't want the local symbols, and we don't want the section
  33026. +     contents.  */
  33027. +  if ((input_bfd->flags & DYNAMIC) != 0)
  33028. +    return true;
  33029. +
  33030. +  emit_relocs = (finfo->info->relocateable
  33031. +         || finfo->info->emitrelocations
  33032. +         || bed->elf_backend_emit_relocs);
  33033. +
  33034. +  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
  33035. +  if (elf_bad_symtab (input_bfd))
  33036. +    {
  33037. +      locsymcount = symtab_hdr->sh_size / sizeof (Elf_External_Sym);
  33038. +      extsymoff = 0;
  33039. +    }
  33040. +  else
  33041. +    {
  33042. +      locsymcount = symtab_hdr->sh_info;
  33043. +      extsymoff = symtab_hdr->sh_info;
  33044. +    }
  33045. +
  33046. +  /* Read the local symbols.  */
  33047. +  isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
  33048. +  if (isymbuf == NULL && locsymcount != 0)
  33049. +    {
  33050. +      isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
  33051. +                      finfo->internal_syms,
  33052. +                      finfo->external_syms,
  33053. +                      finfo->locsym_shndx);
  33054. +      if (isymbuf == NULL)
  33055. +    return false;
  33056. +    }
  33057. +
  33058. +  /* Find local symbol sections and adjust values of symbols in
  33059. +     SEC_MERGE sections.  Write out those local symbols we know are
  33060. +     going into the output file.  */
  33061. +  isymend = isymbuf + locsymcount;
  33062. +  for (isym = isymbuf, pindex = finfo->indices, ppsection = finfo->sections;
  33063. +       isym < isymend;
  33064. +       isym++, pindex++, ppsection++)
  33065. +    {
  33066. +      asection *isec;
  33067. +      const char *name;
  33068. +      Elf_Internal_Sym osym;
  33069. +
  33070. +      *pindex = -1;
  33071. +
  33072. +      if (elf_bad_symtab (input_bfd))
  33073. +    {
  33074. +      if (ELF_ST_BIND (isym->st_info) != STB_LOCAL)
  33075. +        {
  33076. +          *ppsection = NULL;
  33077. +          continue;
  33078. +        }
  33079. +    }
  33080. +
  33081. +      if (isym->st_shndx == SHN_UNDEF)
  33082. +    isec = bfd_und_section_ptr;
  33083. +      else if (isym->st_shndx < SHN_LORESERVE
  33084. +           || isym->st_shndx > SHN_HIRESERVE)
  33085. +    {
  33086. +      isec = section_from_elf_index (input_bfd, isym->st_shndx);
  33087. +      if (isec
  33088. +          && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
  33089. +          && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
  33090. +        isym->st_value =
  33091. +          _bfd_merged_section_offset (output_bfd, &isec,
  33092. +                      elf_section_data (isec)->sec_info,
  33093. +                      isym->st_value, (bfd_vma) 0);
  33094. +    }
  33095. +      else if (isym->st_shndx == SHN_ABS)
  33096. +    isec = bfd_abs_section_ptr;
  33097. +      else if (isym->st_shndx == SHN_COMMON)
  33098. +    isec = bfd_com_section_ptr;
  33099. +      else
  33100. +    {
  33101. +      /* Who knows?  */
  33102. +      isec = NULL;
  33103. +    }
  33104. +
  33105. +      *ppsection = isec;
  33106. +
  33107. +      /* Don't output the first, undefined, symbol.  */
  33108. +      if (ppsection == finfo->sections)
  33109. +    continue;
  33110. +
  33111. +      if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
  33112. +    {
  33113. +      /* We never output section symbols.  Instead, we use the
  33114. +         section symbol of the corresponding section in the output
  33115. +         file.  */
  33116. +      continue;
  33117. +    }
  33118. +
  33119. +      /* If we are stripping all symbols, we don't want to output this
  33120. +     one.  */
  33121. +      if (finfo->info->strip == strip_all)
  33122. +    continue;
  33123. +
  33124. +      /* If we are discarding all local symbols, we don't want to
  33125. +     output this one.  If we are generating a relocateable output
  33126. +     file, then some of the local symbols may be required by
  33127. +     relocs; we output them below as we discover that they are
  33128. +     needed.  */
  33129. +      if (finfo->info->discard == discard_all)
  33130. +    continue;
  33131. +
  33132. +      /* If this symbol is defined in a section which we are
  33133. +     discarding, we don't need to keep it, but note that
  33134. +     linker_mark is only reliable for sections that have contents.
  33135. +     For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
  33136. +     as well as linker_mark.  */
  33137. +      if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
  33138. +      && isec != NULL
  33139. +      && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
  33140. +          || (! finfo->info->relocateable
  33141. +          && (isec->flags & SEC_EXCLUDE) != 0)))
  33142. +    continue;
  33143. +
  33144. +      /* Get the name of the symbol.  */
  33145. +      name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
  33146. +                          isym->st_name);
  33147. +      if (name == NULL)
  33148. +    return false;
  33149. +
  33150. +      /* See if we are discarding symbols with this name.  */
  33151. +      if ((finfo->info->strip == strip_some
  33152. +       && (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)
  33153. +